OffsetTime of(LocalTime time, ZoneOffset offset)
creates an instance of OffsetTime from a local time and an offset.
of
has the following syntax.
public static OffsetTime of(LocalTime time, ZoneOffset offset)
The following example shows how to use of
.
import java.time.LocalTime; import java.time.OffsetTime; import java.time.ZoneOffset; // w w w .ja v a 2 s. co m public class Main { public static void main(String[] args) { OffsetTime m = OffsetTime.of(LocalTime.now(),ZoneOffset.UTC); System.out.println(m); } }
The code above generates the following result.