Java Instant atZone() methodThe atZone() method of Java Instant class is used to combine the instant with a time-zone to create a ZonedDateTime. SyntaxParametersZone - The Zone to combine with, not null. ReturnThe Zone date-time formed from this instant and the specified Zone, not null. ExceptionsDateTimeException - If the result exceeds the supported range. Example 1Output: The output will be like this. 2018-07-17T10:37:30Z 2017-07-17T13:37:30+03:00[Asia/Aden] Example 2Output: Machine Time Now : 2016-11-29T14:23:25.551Z In New Delhi(Asia) Time Zone : 2018-07-17T06:23:25.551-08:00[Asia/New_Delhi] In 'GMT+01:00' Time Zone : 2016-07-17T15:23:25.551+01:00[GMT+01:00] Next TopicJava-instant-adjustinto-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