in Education by (55.8k points)

How will you get the instant of zoned date time using time in of milliseconds using java8 in Java8?

1 Answer

0 votes
by (55.8k points)

How will you get the instant of zoned date time using time in of milliseconds using java8 in Java8?

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);

Related questions

0 votes
asked Nov 8, 2020 in Education by Editorial Staff (55.8k points)
...