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.

Jackson adjusts date even though date format doesn't contain timezone

See original GitHub issue

For some reason jackson adjusts the date, even though the date format doesn’t contain the timezone. E.g. @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss")

Binds a string of “2018-02-15T11:43:00” to a Date of “2018-02-15 12:43:00” on my local system. Shouldn’t jackson be neutral on the timezone if it is not explicitly provided? Is it possible to configure the current version of jackson to follow the expected behavior (Date of “2018-02-15 11:43:00” in above case)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

6reactions
qianlongcommented, Apr 28, 2020

Just for people who are searching the same issue and have reached this ticket, if your date is such like a birthday, and you don’t care about the timezone and timestamp at all, you’d better use LocalDateTime or LocalDate instead of Date.

6reactions
xyxz-webcommented, Feb 28, 2018

I don’t want to retain timezone information. I just want the deserialized Date to have exactly the same values as the string, completely ignoring the timezone problem. Can configOverrides be used for deserializion too? Or is it just for serialization?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Set Jackson Timezone for Date deserialization - Stack Overflow
If you really want Jackson to return a date with another time zone than UTC (and I myself have several good arguments for...
Read more >
Jackson Date - Baeldung
It's important to note that Jackson will serialize the Date to a timestamp format by default (number of milliseconds since January 1st, 1970, ......
Read more >
A practical example for Handling Time Zone conversion in a ...
This article mainly focused on checking the ability to handle the time zones with different java date/time data structures.
Read more >
Propose Jackson 3 should serialise date/time classes as RFC ...
Could I propose date/time classes (in particular java.time.*) serialise as RFC 3339 / ISO 8601 interchange format by default for Jackson 3, and...
Read more >
DeserializationFeature (jackson-databind 2.9.0 API) - FasterXML
getTimeZone () should be used to adjust Date/Time values on deserialization, even if value itself contains timezone information. EAGER_DESERIALIZER_FETCH.
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