question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

StdDateFormat: add option to serialize timezone offset with a colon

See original GitHub issue

Jackson’s StdDateFormat serializes datetimes without colon in the timezone offset, eg. 1970-01-01T01:00:00.123+0100.

Java8 and Joda have decided to include a colon in the offset, eg 1970-01-01T01:00:00.123+01:00.

Although Joda accepts to deserialize a datetime with or without the colon, Java8 considers the colon as mandatory and fails to deserialize datetimes produced Jackson’s StdDateFormat.

In addition, some platforms like iOS also require a colon in the offset and are therefore also unable to read dates produces by Jackson’s StdDateFormat.

Consequence: It would be nice if Jackson’s StdDateFormat could be easily configured, extended or customized to include a colon in the timezone offset.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:15 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
lozforcecommented, Dec 7, 2019

spring.jackson.date-format=yyyy-MM-dd'T'HH:mm:ss.SSSXXX The triple X means to use colon per SimpleDateFormat docs from Oracle. https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html?is-external=true

0reactions
cowtowncodercommented, Oct 5, 2017

@caeaugusto no problem; and I am sorry to hear in a way it is JDK issue… since it is not something we can easily address at this point. But if you or anyone else finds workarounds, links to documentation, maybe even reported bugs in oracle’s bug tracker, those would be good additions here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

StdDateFormat (jackson-databind 2.11.0 API) - FasterXML
Accessor for checking whether this instance would include colon within timezone serialization or not: if {code true}, timezone offset is serialized like -06:00 ......
Read more >
java - Jackson OffsetDateTime serialization Z instead of +00 ...
Is there something I'm missing or doing wrong here, or anyway I can get the timezone information serialized as the +00:00 format instead...
Read more >
Jackson Data Binding Source Code - JAR
Inclusion of colon as separator, as default setting, started in Jackson 2.11: ... timezone offset * is serialized like {@code -06:00}; if {code...
Read more >
com.fasterxml.jackson.databind.util.StdDateFormat.<init> java ...
"Mutant factory" method that will return an instance that has specified * handling of colon when serializing timezone (timezone either written * like...
Read more >
lamsfoundation-lams-39bc85b / - 3rdParty_sources / - jackson
public StdDateFormat withTimeZone(TimeZone tz) { if (tz == null) { tz ... that has specified * handling of colon when serializing timezone (timezone...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found