Reputation: 931
i use a postgresql database and i save there a normal "timestamp without timezone" value.
this looks like this in my database: 2014-05-09 16:04:01.889
now i have created a pojo with a JsonFormat annoation to format my timestamp:
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern="dd.MM.yyyy,HH:mm")
private Timestamp date;
but this returns me:
date": "09.05.2014,14:04"
The hours are wrong, it should be 16 and not 14.. what do i wrong ?
Upvotes: 1
Views: 3819
Reputation: 10853
The difference in hours definitely comes from the difference in the time zones. According to the Jackson Date/Time FAQ, Jackson uses the GMT timezone by default. I suggest you to follow the wiki page and this stackoverflow answer to fix the handling of the date/time in your application.
Upvotes: 2