@DateTimeFormat in Spring throws error in one day

I am currently using @DateTimeFormat in a domain object as follows:

@DateTimeFormat(pattern = "MM/dd/yyyy")
private Date startDate = new Date();

In Spring MVC controller, I post today: 10/19/2011 using jQuery UI Date picker, and I confirm that this is sent as an HTTP Post parameter using firebug as follows:

startDate=10%2F19%2F2011

Unfortunately, as soon as it gets to Spring on the server, it will save the date as 10/18/2011 - there is an error in one day.

There is nothing in my code that even remotely relates to a date - there are no calculations or anything else related to that date.

Is there something about @DateTimeFormat that I should know about?

Can something in Hibernate be responsible for changing the date?

. , creationDate, . , -, startDate.

Start Date              Creation Date (actual timestamp, not user input)
2011-04-17 19:00:00     2011-04-17 21:32:27
2011-04-18 19:00:00     2011-04-18 21:14:01
2011-04-20 19:00:00     2011-04-20 23:06:47
2011-04-26 19:00:00     2011-04-26 23:24:34
2011-04-28 19:00:00     2011-04-28 20:07:06
2011-05-01 19:00:00     2011-05-02 13:35:37
2011-06-21 19:00:00     2011-06-22 15:06:36
2011-07-28 19:00:00     2011-07-29 15:32:35
2011-09-03 19:00:00     2011-09-04 13:11:45
2011-10-11 19:00:00     2011-10-12 11:45:14
2011-10-11 19:00:00     2011-10-12 11:49:55
2011-10-18 19:00:00     2011-10-19 02:20:43

, , , , , 19:00:00, , 19:00:00.

Java: (

, Spring , 10/19/2011 - , , 2011-10-18 19:00:00.

?

+3
2

, . Date - , , (, UTC, ), , . , , "10/18/2011", .

Spring Joda Time, - LocalDate, .

+3

, JVM , , . :

-Duser.timezone="Asia/Dhaka"
+1

All Articles