简体   繁体   中英

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?

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.

在.net代码中使用DateTimeOffset ,它将正常工作。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM