Example usage for java.time ZonedDateTime ofLocal

List of usage examples for java.time ZonedDateTime ofLocal

Introduction

In this page you can find the example usage for java.time ZonedDateTime ofLocal.

Prototype

public static ZonedDateTime ofLocal(LocalDateTime localDateTime, ZoneId zone, ZoneOffset preferredOffset) 

Source Link

Document

Obtains an instance of ZonedDateTime from a local date-time using the preferred offset if possible.

Usage

From source file:Main.java

public static void main(String[] args) {
    ZonedDateTime z = ZonedDateTime.ofLocal(LocalDateTime.now(), ZoneId.systemDefault(), ZoneOffset.UTC);

    System.out.println(z);/* www  . j  ava  2 s.  c  om*/

}