Jackson adjusts date even though date format doesn't contain timezone
See original GitHub issueFor 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:
- Created 6 years ago
- Comments:11 (5 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
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?