How to convert epoch like 1413225446.92000 to ZonedDateTime in java? The code given expects long value hence this will throw NumberFormatException for the value given above. Answer java.time can directly parse your string Edit: If your millisecond value is always non-negative, the following DateTimeFormatter can parse it. Now parsing into a ZonedDateTime is just one method call: Output is: 2014-10-13T11:37:26.920-07:00[America/Los_Angeles]
Tag: zoneddatetime
Jackson serializes a ZonedDateTime wrongly in Spring Boot
I have a simple application with Spring Boot and Jetty. I have a simple controller returning an object which has a Java 8 ZonedDateTime: In my RestController I simply have: I was expecting the ZonedDateTime to be formatted according to the ISO format, but instead I am getting a whole JSON dump of the class like this: I just have