java - How to map timestamp to date in Object mapper -


right mapping timestamp date using object mapper, turning date object's date this, if timestamp 1359657000, it's date should 01/31/2013, showing me date 01/31/1970, didn't issue approach.

public class abcd{     private date year  } 

and json

{ "data": { "fromdate": 1335810600" } } 

and when map object mapper

objectmapper mapper =new mapper(); mapper.readvalue(data,abcd.class); 

now value of year coming 31st dec 1970, although should coming 31st dec 2013

not sure if understand issue, in of situations don't want deal timestamps:

mapper.disable(serializationfeature.write_dates_as_timestamps); 

then can define format of date:

@jsonformat(shape = jsonformat.shape.string, pattern = "dd-mm-yyyy") public date date; 

Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -