1

How can I convert a number like this : 1467158498669 from à json file to java field of type : ZonedDateTime ?

Thank you !

adaso
  • 41
  • 5

1 Answers1

1

You can use Instant.ofEpochMilli

long date = 1467158498669l;

ZonedDateTime zoneTime = Instant.ofEpochMilli(date).atZone(ZoneId.of("Canada/Atlantic"));

OR

ZonedDateTime  zdt = ZonedDateTime.ofInstant(Instant.ofEpochMilli(date),
            ZoneId.of("Canada/Atlantic"));
Deadpool
  • 33,221
  • 11
  • 51
  • 91