1

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

Thank you !

adaso
  • 61
  • 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"));
Ryuzaki L
  • 37,302
  • 12
  • 68
  • 98