Sounds like a book title, doesn't it? It's a horror story.
Currently, I'm using a class library that uses the Windows Registry to return information about a specific date. I found it on Code Project and it REQUIRED a full trust environment. Luckily, I didn't need to run in a shared hosting environment and I didn't want to build my own DST provider for every time zone. I've been using it for about 2 years now and I think it's time to move over to the new TimeZone2 functionality that will be included in the .NET Framework 3.5 release.
Kathy Kam, member of the BCL Team, says from a post a while ago:
In the “Orcas” September CTP, you’ll see that the BCL team has added a new class named “System.TimeZone2” that will allow you to:
- Convert a DateTime from one time zone (not necessarily your machine’s time zone) to another
- Get an object that describes your local time zone
- Get an array of objects that describes all the available time zones on your machine
- Serialize a time zone into a string
- Create your own time zone object to represent any custom time zones
The best part about this is that… if you are on an Vista machine… all of those functionality will have Vista’s Dynamic Time Zone support, because our calculations are done with the time zone data available on your OS.
This is wonderful news for me. I no longer have to depend on the old class library to store my time zone information.
For more information on the TimeZoneInfo Class, you can read about it on the MSDN site.