Incorrect deserialisation of ZoneDateTime from JSON with ObjectMapper

谁说我不能喝 提交于 2019-12-25 08:32:22

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!