Java - date saved as the day before

前端 未结 3 1125
遇见更好的自我
遇见更好的自我 2020-12-14 08:48

I\'m experiencing a very weird behaviour while saving dates on database. On my (Linux centOS 6.2) server I use glassfish application server (3.1.1 - build 12) and Java (1.7.

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-14 09:28

    Just set the time of the date to 12:00 (instead of the default 0:00) and you should be fine. The issue is that the GWT time zone library does not include all leap years from before 1990, and thus you will get a wrong time at the server (since the value is sent in the form of a timestamp and is one hour off).

    By the way: GWT has a built-in date picker, see its demo at http://gwt.google.com/samples/Showcase/Showcase.html#!CwDatePicker

提交回复
热议问题