Java ZonedDateTime classJava ZonedDateTime class is an immutable representation of a date-time with a time-zone. It inherits Object class and implements the ChronoZonedDateTime interface. ZonedDateTime class is used to store all date and time fields, to a precision of nanoseconds, and a time-zone with a zone offset used to handle ambiguous local date-times. Java ZonedDateTime class declarationLet's see the declaration of java.time.ZonedDateTime class. Methods of Java ZonedDateTime
Java ZonedDateTime class ExampleOutput: 2016-10-05T08:20:10+05:30[Asia/Kolkata] Java ZonedDateTime class Example: of() and withZoneSameInstant()Output: In India Central Time Zone: 2017-01-19T15:26+05:30[Asia/Kolkata] In Tokyo Central Time Zone:2017-01-19T18:56+09:00[Asia/Tokyo] Java ZonedDateTime class Example: getZone()Output: Asia/Kolkata Java ZonedDateTime class Example: minus()Output: 2016-09-15T12:54:01.354+05:30[Asia/Kolkata] Java ZonedDateTime class Example: plus()Output: 2017-05-25T12:56:12.417+05:30[Asia/Kolkata] Next TopicJava ZoneId
|