« solution task’s webmap element has case sensitivity and EntityName parsing bugs | Main | Quicken 2004 & TurboTax 2003 Premiere Home & Business »

Serializing DateTimes

A DateTime value doesn’t include time zone information. You must therefore keep track of the implied time zone by other means.

When DateTime values are serialized using the XML serializer, the default format includes the local machine’s time zone, which may not be correct, if for example your keeping all DateTime values in UTC.

On the flip side, deserializing a DateTime will return a value adjusted for the local time zone, taking the serialized time zone value into account.

Clemens Vasters has a nice detailed write up of the DateTime UTC serialization problem and answered my question of whether there was a way to tell the serializer how to handle the time zone.

 

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)