1

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 ?

user2115378
  • 931
  • 3
  • 14
  • 22

1 Answers1

2

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.

Community
  • 1
  • 1
Alexey Gavrilov
  • 10,593
  • 2
  • 38
  • 48