OffsetTime ofInstant(Instant instant, ZoneId zone)
creates an instance of OffsetTime from an Instant and zone ID.
ofInstant
has the following syntax.
public static OffsetTime ofInstant(Instant instant, ZoneId zone)
The following example shows how to use ofInstant
.
import java.time.Instant; import java.time.OffsetTime; import java.time.ZoneId; /* www . j av a 2s . 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.