Posts

Showing posts with the label zoneddatetime

Issue creating ZonedDateTime instance based on LocalDateTime

Issue creating ZonedDateTime instance based on LocalDateTime I'm seeing some behavior I can't explain, hoping somebody can point me in the right direction. I'm first creating a LocalDateTime instance, then getting to ZonedDateTime by applying the "Europe/London" time zone to the LocalDateTime and then use a DateTimeFormatter to print to output. I would expect to see the exact same time as specified in the LocalDateTime instance, but in below example the output for zonedDateTimeBeforeDST_Original is showing one hour later than what I would expect. So, in short: why does 01:55 in my LocalDateTime become 02:55 for the ZonedDateTime? FYI, didn't see this behavior for other time zones. The London one seems to be a special case. //init date pattern final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); final DateTimeFormatter formatterOut = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss XXX"); Lo...