Expand my Community achievements bar.

Date type issue from ActionScript to Java

Avatar

Level 1
Hi,



I am testing FDS and trying to save some data including a
Date field to MySQL database. When I select a date with DateField,
for instance, 2006/08/08, it does show 2006/08/08 on the client.
But the issue is that it becomes as 2008/08/07 in my java DAO, and
the date inserted into the database is 2008/08/07 rather than
2008/08/08. There is a one day difference with date that I want to
insert. The code in my java DAO is something like that:



ps.setDate(4, new
java.sql.Date(employee.getStartDate().getTime()));



If I print the date with
System.out.println(employee.getStartDate().toString()) before the
code above, it shows 2008/08/07.

I guess it maybe TimeZone and format issue. However, I didn't
find any sample on this.



Any idea on how to fix it.

Thanks.

0 Replies