ObjectMapper default timezone is GMT, should be UTC
See original GitHub issueObjectMapper is configured with GMT timezone:
protected final static BaseSettings DEFAULT_BASE = new BaseSettings(
null, // can not share global ClassIntrospector any more (2.5+)
DEFAULT_ANNOTATION_INTROSPECTOR,
STD_VISIBILITY_CHECKER, null, TypeFactory.defaultInstance(),
null, StdDateFormat.instance, null,
Locale.getDefault(),
// TimeZone.getDefault()
TimeZone.getTimeZone("GMT"), // <= HERE
Base64Variants.getDefaultVariant() // 2.1
);
(it’s on line 280)
But on many places in documentation and even in javadoc it’s written that it’s configured with UTC timezone. It is even cleaner to use UTC.
Issue Analytics
- State:
- Created 8 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
ObjectMapper default timezone is GMT, should be UTC #915
Changed for 2.7.0 so that default TimeZone for core jackson-databind is now UTC, consistently. No apparent breakage wrt unit tests.
Read more >Default timezone for DateTime deserialization with Jackson ...
So, to answer your question about time zones, it sounds like by default Jackson always serializes using UTC (no time zone offset) which...
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 >com.fasterxml.jackson.databind.ObjectMapper.setTimeZone ...
Method for overriding default TimeZone to use for formatting. Default value used is UTC (NOT default TimeZone of JVM). Popular methods of ObjectMapper....
Read more >Handling Timezones in a Spring Boot Application - Reflectoring
You can change the database time zone manually but Oracle recommends that you keep it as UTC (the default) to avoid data conversion...
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 FreeTop 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
Top GitHub Comments
@cemo thank you for asking a good question: sometimes there are no good reasons, or reasons seem less convincing than what I thought.
Thanks for great explanation.