When I try to convert OffsetDateTime
to LocalDateTime
from java.time, I expect the resulting LocalDateTime
to be updated with the local time zone. So, If I have an OffsetDateTime
of 2011-12-03T10:00:00Z
, and my local timezone is UTC+2, I expect the LocalDateTime to be 2011-12-03T12:00:00
, but I get instead 2011-12-03T10:00:00
. I'm converting it with the method toLocalDateTime()
that OffsetDateTime
has. It seems that it only truncates the date, removing the offset part, without adjusting the time.
So I'm trying to figure out a way to get a LocalDateTime
that represents the local date time taking into account the zone offset. Following the example, I would like to get 2011-12-03T12:00:00