I've got various java.util.Date
objects with values of this format: 2014-01-21 10:28:57.122Z
. I would like to convert them all to ZonedDateTime
objects.
According to this SO question, and ZonedDateTime
's ofInstant()
, one way is like so:
ZonedDateTime z = ZonedDateTime.ofInstant(dateObject.toInstant(), ZoneId);
The problem is, how do I figure out what to use for the ZoneId
parameter? I can't use my system time (ZoneId.systemDefault()
) because my Date
objects all have different timezones.