users@jaxb.java.net

dateTime problem with timezone

From: Wah Yim <ky4h_at_yahoo.com>
Date: Thu, 31 Aug 2006 13:40:18 -0700 (PDT)

Hello,

My client is sending me a XML document, which contains a timestamp field of type "dateTime" according to the XML schema specs (http://www.w3.org/TR/xmlschema-2/#dateTime). The timestamp format looks like:

yyyy-MM-ddTHH:mm:ss.SSS

Where yyyy-MM-dd is the date part, followed by the character 'T', then the time part in the format of HH:mm:ss.SSS.

According to the XML schema, when no timezone offset string is present at the end, this represents a UTC time. The problem is, my client is encoding this timestamp string with Eastern Standard Time. When I use JAXB to unmarshal the XML document, this becomes a problem because the resulting time is off by 4 to 5 hours (depending on whether or not we're on daylights saving time). For example, the timestamp of 2006-08-31T16:00:00.000 is actually parsed into 2006-8-31 at 12:00, while my client really means 16:00 pm.

This is also a problem when I tries to send a XML document back to my client, when they expect the same yyyy-MM-ddTHH:mm:ss.SSS in EST. Instead, when I use JAXB to marshal the time 2006-8-31 at 16:00 EST, the resulting string becomes 2006-08-31T16:00:00.000-04:00 (notice that the timezone offset is appended).

Now the question is, all I'm interested in dealing with is EST. Can I configure JAXB such that it would marshal / unmarshal a dateTime field without any timezone adjustment?

Thanks,
-wah