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

Open 1 Answers 49 Views Education

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

1 Answer

0

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

Following code gets the instant of local date time using time in of milliseconds -

Instant now = currentDate.toInstant();

ZoneId currentZone = ZoneId.systemDefault();

LocalDateTime localDateTime = LocalDateTime.ofInstant(now, currentZone);

System.out.println("Local date: " + localDateTime);

by (54.6k points)
...