aspose file tools*
The moose likes XML and Related Technologies and the fly likes Unmarshalling a date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Unmarshalling a date" Watch "Unmarshalling a date" New topic

Unmarshalling a date

J Hasenberg

Joined: Oct 09, 2003
Posts: 3
I have some XML that contains a date:
filter effectiveDate="2001-09-17T00:00:00.000-05:00" expirationDate="2001-08-23T00:00:00.000-05:00"
When the XML is unmarshalled using Castor, the object attribute containing the, and subsequently the SQL that updates my database, is a day earlier than the XML. For instance the 2001-09-17 date in XML is now 2001-09-16. See below:
UPDATE ValueFilter SET effectiveDate='2001-09-16', expirationDate='2001-08-22' WHERE . . . )
Is there some kind of conversion being done for me by the JDK related to daylight savings time that might cause this? I am using the IBM JDK 1.3.1.
Any help as to why this is happening and how to avoid it would be greatly appreciated.
It is sorta covered in the JavaRanch Style Guide.
subject: Unmarshalling a date