Q:

Date is changed after persist in database?

User inputs date from JSP page, and it converts to Joda DateTime, the string output is 

2014-03-26T00:00:00.000+09:00 

However when I persist this entity containing date filed in database, and retrieve and print out again, it becomes 

2014-03-25T09:00:00.000+09:00.

I don't know why database make this change to minus one day.
I use postgres, hibernate JPA for application development.
Thanks in advance.

A:

What is the value in the database? Use pgAdmin app, the psql command line tool, or some other database admin tool to query Postgres directly.
What data type are you using in Postgres? You probably should be using TIMESTAMP WITH TIME ZONE. Avoid using the WITHOUT time zone type as it ignores any time zone offset info you may provide. 
Despite the name, neither type stores any time zone info. The difference is whether you want Postgres to pay any attention to time zone info on incoming data. Be sure to read the doc thoroughly and play with it to experiment until understand how date-time works.
Read Always Use TIMESTAMP WITH TIME ZONE by David E. Wheeler, a Postgres expert.

