Web services and incorrect handling of time zones in DateTime

N

nightwatch77

Hi, does anyone know why .Net incorrectly handles time zone conversion
when passing DateTime through web services? The problem is that it
seems to ignore the time zone part. My time zone is CEST, that is GMT
+01:00 + daylight saving. And the web service handles datetimes
correctly provided that they are also in CEST. But when some client
calls my web service passing dates in UTC, the .Net runtime just
ignores that fact and takes just the date & time portion literally.
So for example, when the SOAP message contains datetime like
<SomeDate>2007-09-26T10:00:00+01:00</SomeDate>, the date is received
correctly - it is 10:00 local time.
But when the date is <SomeDate>2007-09-26T09:00Z</SomeDate> (which is
exactly the same time as previously, but in UTC), it becomes DateTime
2007-09-26 09:00:00 (in local time also) which is just incorrect.
Logically thinking, the UTC time should be converted to local time
because it is clear that it is passed as UTC and needs to be adjusted
to local time. DateTime structure does not contain time zone
information, so I'm unable to tell whether the web service client has
specified the date in UTC, or local time, or whatewer time zone it had
- therefore it's not possible to correct this error 'manually' - I
would have to mess with SOAP serialization to handle that.
Is this by design (very poor design in my opinion) or an error?

Best regards
RG
 
C

Cor Ligthert[MVP]

Rafal,

You are not the first one writing this, I think that it is an error by
design.

I have no idea if this is fixed in newer versions.

Cor
 
N

nightwatch77

OK, I have found some information on this error, but no feasible
solution.
Is it possible to correct that without putting any additional
requirements on web service clients?

RG
 

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