Reputation: 21
I have a WCF Web-Service with a parameter of type DateTime. This Web-Service runs on Windows Azure. Our client is written in Java and run on a different time zone. When it calls this web-serve and passed a date-time (E.g. 2011-03-27 12:00+0100), the .NET Framework will automatically convert this date-time into the time zone of Windows Azure servers.
Is it possible to skip this conversion and get the exact time sent by the client?
Upvotes: 2
Views: 1176
Reputation: 25200
This is the correct behaviour: in general it's best to work with co-ordinated universal time when working with distributed services. In your case Azure / WCF should report the time as 13:00, as the Azure clocks are set to UT.
Assuming that your Java client encodes dates in the proper way, then
Best practices for DateTime serialization in .NET 3.5
gives some hints on how to extract out the local date and time and the timezone information entered by the user. (Scroll to the bottom answer.)
Upvotes: 1