Instant atOffset(ZoneOffset offset) example
Description
Instant atOffset(ZoneOffset offset)
combines this instant with
an offset to create an OffsetDateTime.
Syntax
atOffset
has the following syntax.
public OffsetDateTime atOffset(ZoneOffset offset)
Example
The following example shows how to use atOffset
.
import java.time.Instant;
import java.time.ZoneOffset;
//w w w . j a v a 2s .c om
public class Main {
public static void main(String[] args) {
Instant instant = Instant.parse("2014-12-03T10:15:30.00Z");
System.out.println(instant.atOffset(ZoneOffset.UTC));
}
}
The code above generates the following result.