OffsetDateTime toZonedDateTime() example
Description
OffsetDateTime toZonedDateTime()
converts this date-time to a ZonedDateTime using the offset as the zone ID.
Syntax
toZonedDateTime
has the following syntax.
public ZonedDateTime toZonedDateTime()
Example
The following example shows how to use toZonedDateTime
.
import java.time.OffsetDateTime;
import java.time.ZonedDateTime;
/*from w w w .j a v a2 s . c o m*/
public class Main {
public static void main(String[] args) {
OffsetDateTime o = OffsetDateTime.MAX;
ZonedDateTime z= o.toZonedDateTime();
System.out.println(z);
}
}
The code above generates the following result.