LocalTime atOffset(ZoneOffset offset)
combines this time with
an offset to create an OffsetTime.
atOffset
has the following syntax.
public OffsetTime atOffset(ZoneOffset offset)
The following example shows how to use atOffset
.
import java.time.LocalTime; import java.time.OffsetTime; import java.time.ZoneOffset; //w w w. j a v a2 s. 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.