Start with three variables, all are System.DateTime.
a: 10/2/2009 2:30:00 PM
b: 10/2/2009 2:30:00 PM
c: 10/2/2009 2:30:00 PM
Compare them to each other.
Ok, we have established that all three dates are equal. So when we convert them all to Universal time, we will get the same result. Right?
a.ToUniversalTime: 10/2/2009 9:30:00 PM
b.ToUniversalTime: 10/2/2009 9:30:00 PM
c.ToUniversalTime: 10/2/2009 2:30:00 PM
In .NET 2, System.DateTime was subtly and yet radically changed. Rather than adding full support for time zones, support for local and UTC time was hacked into two unused bits in the underlying data structure. These bits are the date’s “Kind” property.
Why does this matter? Well, when you serialize a DateTime the Framework generally uses something like this:
So when your counter-party reads it back in, there are going to see two, maybe three, very different dates. And in case you are wondering, this did happen to me in a production scenario.