Java Instant atOffset() methodThe atOffset() method of Java Instant class is used to combine the instant with an offset to create an OffsetDateTime. SyntaxParametersoffset - The offset to combine with, not null. ReturnThe offset date-time formed from this instant and the specified offset, not null. ExceptionsDateTimeException - If the result exceeds the supported range. Example 1Output: The output will be like this. 2017-02-03T10:37:30Z 2017-02-03T15:37:30+05:00 Example 2Output: 2017-07-03T22:35:29.771+05:30 2017-07-03T22:35:29.771 2017-07-03 22:35:29.771 2017-07-03T22:35:29.771+05:30 2017-07-03T17:05:29.771Z 22:35:29.771+05:30 Example 3Output: Year : 2017 Month : 7 Day of Month : 6 Day of Week : THURSDAY Day of Year : 187 Offset : +05:30 Example 4Output: Hour : 21 Minute : 41 Second : 10 Nano : 941000000 Next TopicJava-instant-ofepochsecond-method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India