LocalTime atOffset(ZoneOffset offset) example
Description
LocalTime atOffset(ZoneOffset offset)
combines this time with
an offset to create an OffsetTime.
Syntax
atOffset
has the following syntax.
public OffsetTime atOffset(ZoneOffset offset)
Example
The following example shows how to use atOffset
.
import java.time.LocalTime;
import java.time.OffsetTime;
import java.time.ZoneOffset;
/*from w w w . j a va 2s.c o m*/
public class Main {
public static void main(String[] args) {
LocalTime l = LocalTime.now();
OffsetTime t = l.atOffset(ZoneOffset.UTC);
System.out.println(t);
}
}
The code above generates the following result.