I have the time in milliseconds and I need to convert it to a ZonedDateTime object.
I have the following code
long m = System.currentTimeMillis();
L
You can construct a ZonedDateTime
from an instant (this uses the system zone ID):
//Instant is time-zone unaware, the below will convert to the given zone
ZonedDateTime zdt = ZonedDateTime.ofInstant(Instant.ofEpochMilli(m),
ZoneId.systemDefault());
And if you need a LocalDateTime
instance from that:
//And this date-time will be "local" to the above zone
LocalDateTime ldt = zdt.toLocalDateTime();