OffsetTime ofInstant(Instant instant, ZoneId zone) example
Description
OffsetTime ofInstant(Instant instant, ZoneId zone)
creates an instance of OffsetTime from an Instant and zone ID.
Syntax
ofInstant
has the following syntax.
public static OffsetTime ofInstant(Instant instant, ZoneId zone)
Example
The following example shows how to use ofInstant
.
import java.time.Instant;
import java.time.OffsetTime;
import java.time.ZoneId;
//from w w w.j a va2s .c o m
public class Main {
public static void main(String[] args) {
OffsetTime m = OffsetTime.ofInstant(Instant.now(),ZoneId.systemDefault());
System.out.println(m);
}
}
The code above generates the following result.