Time Zones suck

Tue, Sep 05, 2006 @ 5:18 AM - Josh Einstein

Do you want Time Zone support in System.DateTime? No, you don't. Trust me. Every now and then I come across a blog posting or article about how Microsoft is investigating ways to extend System.DateTime to meet customer demand for time zone support. Basically, customers are asking Microsoft to make System.DateTime be able to represent a given date/time and UTC offset. This is bad for a number of reasons, but the biggest reason is that time zones SUCK!

Maybe you remember my quest to eliminate all of the evil that time zones have inflicted on me by converting my life to UTC while the world around me continued ignorantly using Eastern Standard Time? Well that didn't go over too well because interacting with other people was just too difficult. Fortunately, computers don't have that problem. If you follow these simple rules, you can live a happy pain-free coexistence with DateTime.

So does this mean I think .NET is completely sufficient when it comes to dates and times? Not by a long shot. But I don't think the DateTime structure itself needs to be modified. In fact, I think it's the TimeZone class that needs to be enhanced. Here's what I'd like to see added to TimeZone.

Currently, only the local time zone is supported by the TimeZone class. I would like to see all the same time zones in the Windows registry (as seen in the date/time control panel applet) supported. Second in my list is a way to get a TimeZone from a name such as “Eastern Standard Time” or “EST”. This way you could parse out the time zone or UTC offset often found in internet email messages (see RFC 822). Third on my list is basically the reverse of #2, that is, the ability to get the standard name for the time zone. Fourth on the list is the ability to convert a DateTime to a localized time zone for an internet message. But if you follow my recommendations at the beginning of this post, you should be sending all your dates as UTC!! Finally, the ability for DateTime to parse a RFC 822 date header. The return value would always be in UTC, but unlike the current implementation, it wouldn't ignore the offset. So if the date was: Thu, 31 Aug 2006 06:23:59 -0400, then it would be parsed as a UTC DateTime with the value 8/31/2006 10:23:59.

So anyway, what I'm basically saying is leave DateTime alone and fix TimeZone. :)