问题
i'm receiving long = 1417471200000 which should be 2017 year, but, when ZoneDateTime is deserialized its value is +48908-06-13 16:00:00
i'm already have maven dependency of
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.6.5</version>
Where i made a mistake?
also, when i deserialize this wrong ZoneDateTime object to long, its value is back again 1417471200000
回答1:
The time you have here appears to be in milliseconds:
1417471200 = Mon Dec 1 22:00:00 GMT 2014
1417471200000 = Sat Nov 15 16:00:00 GMT 46887
You're passing the milliseconds to something that expects time in seconds.
来源:https://stackoverflow.com/questions/42026453/incorrect-deserialisation-of-zonedatetime-from-json-with-objectmapper