1.

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

Answer»

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

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



Discussion

No Comment Found