.NET Webservice - DateTime XML serialization wrong? (please help)

R

RobertD

Hello,

I have a problem working with german stock data provided by a .NET
webservice. It seems that dates before 1996 are not serialized
correctly. The reason seems to be the daylight savings time rules.

German daylight saving time rules:

1996 - now
last sunday of march to last sunday in october
1981 - 1995
last sunday of march to last sunday in september
before 1981
no daylight saving time


All dates I get are only day, month and year without any time (so
00:00:00.000).

Examples for correct dates serialized by the web service:

2000-10-01T00:00:00.0000000+02:00
2000-12-01T00:00:00.0000000+01:00

Examples for wrong dates serialized by the web service:

1978-10-01T00:00:00.0000000+02:00 (should be +01:00, there was
daylight saving time 1978)
1981-10-01T00:00:00.0000000+02:00 (should be +01:00, daylight saving
ended until 1995 in September)


My consumer is a Java application wich seems to consider the correct
daylight saving time rules. This issue cause me to "lose a day" on
dates before 1996.

Examples for deserialization (Timezone "Europe/Berlin"= +1GMT) :

2000-10-01T00:00:00.0000000+02:00 = Oct 01 2000 00:00:00 (ok)
1978-10-01T00:00:00.0000000+02:00 = Sep 30 1978 23:00:00 (wrong)
1981-10-01T00:00:00.0000000+02:00 = Sep 30 1981 23:00:00 (wrong)

I could reproduce the problem by implementing a simple C# .NET web
service:

....
public DateTime getDateTime(int day, int month, int year, int hour,
int minute)
{
return new DateTime(year,month,day,hour,minute,0,0);
}
....

The problem seems to be, that the .NET web service is always applying
the current daylight saving time rules and dosnt consider that those
rules changed with time.

Localization dosnt seem to be the issue here. So am I wrong or is .NET
my problem. How can I fix this on the .NET side? I know i could just
make a rule on the consumer side ;-)

Thanks for any help or suggestions with this issue!

Robert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top