Posts

Showing posts with the label datetimeoffset

DateTimeFormatter.ISO_OFFSET_DATE_TIME not working as expected

Image
DateTimeFormatter.ISO_OFFSET_DATE_TIME not working as expected Based on this Java Date Time - OffsetDateTime.format() Examples article and this official documentation for DateTimeFormatter I would expect my OffsetDateTime to be serialized as 2011-12-03T10:15:30+00:00 where the offset the offset is +00:00 since its UTC. 2011-12-03T10:15:30+00:00 +00:00 I cannot manage to get the OffsetDateTime to render with an offset, it always just renders with the 'Z' Zulu. What am I doing wrong? This is Spring Boot 2.0.0.RELEASE, and as you can see in the screenshot I've got the following modules on the class path and registered with the objectMapper, although I don't think that's relative because this issue seems to be directly with the DateTimeFormatter, my object mapper is just using the formatter I am giving it. It does have an affect, because as you can see in the second screenshot when I specify the BASIC_ISO_FORMAT it does produce a a different result. BASIC_ISO_FORMAT ...