1.

How Will You Get The Instant Of Zoned Date Time Using Time In Of Milliseconds Using Java8?

Answer»

Following CODE gets the INSTANT of ZONED date time using time in of MILLISECONDS

Instant now = currentDate.toInstant();
ZoneId currentZone = ZoneId.systemDefault();
ZonedDateTime zonedDateTime = ZonedDateTime.ofInstant(now, currentZone);
System.out.println("Zoned date: " + zonedDateTime);

Following code gets the instant of zoned date time using time in of milliseconds −

Instant now = currentDate.toInstant();
ZoneId currentZone = ZoneId.systemDefault();
ZonedDateTime zonedDateTime = ZonedDateTime.ofInstant(now, currentZone);
System.out.println("Zoned date: " + zonedDateTime);



Discussion

No Comment Found