Date – ZonedDateTime

Converting Date to ZonedDateTime can be accomplished via the Instant object obtained from the given Date object and the system default time zone:

// e.g., 2019-03-01T07:25:25.624+02:00[Europe/Athens]
public static ZonedDateTime dateToZonedDateTime(Date date) {

return dateToInstant(date).atZone(DEFAULT_TIME_ZONE);
}

Converting ZonedDateTime to Date is just about converting ZonedDateTime to Instant:

// e.g., Fri Mar 01 07:25:25 EET 2019
public static Date zonedDateTimeToDate(ZonedDateTime zonedDateTime) {

return Date.from(zonedDateTime.toInstant());
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.163.229