title: DateTimeFormatter.ISO_OFFSET_DATE_TIME not working as expected
body: <p>Based on this Java Date Time - <a href="https://www.logicbig.com/how-to/code-snippets/jcode-java-8-date-time-api-offsetdatetime-format.html" rel="nofollow noreferrer">OffsetDateTime.format() Examples</a> article and this official documentation for <a href="https://docs.oracle.com/javase/10/docs/api/java/time/format/DateTimeFormatter.html#patterns" rel="nofollow noreferrer">DateTimeFormatter</a> I would expect my OffsetDateTime to be serialized as <code>2011-12-03T10:15:30+00:00</code> where the offset the offset is <code>+00:00</code> since its UTC. </p>
  
  <p>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?</p>
  
  <p><a href="https://i.stack.imgur.com/4UnuO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4UnuO.png" alt="enter image description here"></a></p>
  
  <p>This is <a href="https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.0-Release-Notes" rel="nofollow noreferrer">Spring Boot 2.0.0.RELEASE</a>, 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. </p>
  
  <p>It does have an affect, because as you can see in the second screenshot when I specify the <code>BASIC_ISO_FORMAT</code> it does produce a a different result. </p>
  
  <p>I do have this property set <code>spring.jackson.date-format= com.fasterxml.jackson.databind.util.ISO8601DateFormat</code> in my application.properties but as I understand it, this has no affect on OffsetDateTime it only supports the legacy Date objects from previous version of java. Incidentally changing this seems to have no affect as expected. </p>
  
  <p>Any help would be appreciated. </p>
  
  <p>Using ISO_ZONED_DATE_TIME format...
  <a href="https://i.stack.imgur.com/FsAlG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FsAlG.png" alt="Using ISO_ZONED_DATE_TIME format"></a></p>
  
  <p>Using BASIC_ISO_FORMAT... this does have an affect so I know the formatter is doing something, I'm just not clear why the ISO_ZONED_DATE_TIME is not rendered as expected.
  <a href="https://i.stack.imgur.com/sgvwZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sgvwZ.png" alt="Using BASIC_ISO_FORMAT"></a></p>
  
  <pre><code> this.objectMapper = objectMapperBuilder.build()      
        .setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE)
        .disable(SerializationFeature.INDENT_OUTPUT)
        .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
        .disable(SerializationFeature.WRITE_DATES_WITH_ZONE_ID);
  
   SimpleModule simpleModule = new SimpleModule();
   simpleModule.addSerializer(OffsetDateTime.class, new JsonSerializer&lt;OffsetDateTime&gt;() {
          @Override
          public void serialize(OffsetDateTime offsetDateTime, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
              String formattedDate = DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(offsetDateTime);
              jsonGenerator.writeString(formattedDate);
          }
      });
  this.objectMapper.registerModule(simpleModule);
  
  OffsetDateTime now = OffsetDateTime.now();
  TimeZone defaultTimeZone = TimeZone.getDefault();
  ZoneId defautlZoneOffset = ZoneOffset.systemDefault();
  String serializedOffsetDateTime = this.objectMapper.writeValueAsString(now);
  //returns -&gt; "2018-06-27T11:45:56.035Z"
  </code></pre>