Some 4 years back, I followed this MSDN article for DateTime usage best practices for building a .Net client on .Net 1.1 and ASMX web services (with SQL 2000 server as the backend). I still remember the serialization issues I had with DateTime and the testing effort it took for servers in different time zones.
My questions is this: Is there a similar best practices document for some of the new technologies like WCF and SQL server 2008, especially with the addition of new datetime types for storing time zone aware info.
This is the environment:
- SQL server 2008 on Pacific Time.
- Web Services layer on a different time zone.
- Clients could be using .Net 2.0 or .Net 3.5 on different time zones. If it makes it easy, we can force everyone to upgrade to .Net 3.5. :)
Any good suggestions/best practices for the data types to be used in each layer?
Unspecified
. When you callToUniversalTime
on it, it will assumeLocal
time and actually do a conversion. The correct way would be doingDateTime.SpecifyKind(myUtcTime, DateTimeKind.Utc)
instead ofToUniversalTime
. – Mastaba