LocalDateTime atZone(ZoneId zone) example
Description
LocalDateTime atZone(ZoneId zone)
combines this date-time
with a time-zone to create a ZonedDateTime.
Syntax
atZone
has the following syntax.
public ZonedDateTime atZone(ZoneId zone)
Example
The following example shows how to use atZone
.
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
// w w w . jav a2 s .co m
public class Main {
public static void main(String[] args) {
LocalDateTime a = LocalDateTime.of(2014, 6, 30, 12, 00);
ZonedDateTime b = a.atZone(ZoneId.systemDefault());
System.out.println(b);
}
}
The code above generates the following result.