Search code examples
javadatetimetimezonegregorian-calendar

Java gregorian calendar and removing time and timezone


I have a gregorian calendar that serializes to the string below during a soap request

2079-07-07T00:00:00.000-07:00

The .NET webservice reads it as the string below

07/07/2079 01:00:00

Is the 07:00 causing the issue? If so how can I get rid of this?


Solution

  • Someone might be able to give you an affirmative answer if you tell us which time zone is configured on your system, but I would assume a mismatch in the DST rules.

    The JVM comes with its own timezone and DST rule database, while Windows (and .NET) uses a different database. In theory, the two databases should of course contain the same rules, but I have ran into differences in the DST rules for historical dates. I would assume there might be differences for dates far in the future as well.

    If you actually want to transport a date value (no time component) over the SOAP service, the easiest solution would be to use the appropriate XML Schema datatype instead of a datetime type.