Monday, April 03, 2006

"Time Zones in the .NET Framework" - With Code Sample

BCLTeam’s WebLog - Time Zones in the .NET Framework

"The single most requested individual feature for the Base Class Libraries that has not been delivered yet is for support for Time Zones other than Local and UTC. This is a feature we are actively exploring for the next release of the .NET Framework.

 


To tide people over, we recently released an updated sample that supports the following scenarios:


-Enumeration of Time Zones from the Windows Registry.


-Conversion of a DateTime instance between Time Zones.


 


The sample can be downloaded from here:


http://download.microsoft.com/download/4/5/5/4555538c-6002-4f04-8c58-2b304af92402/converttimezone.exe


 


The sample is similar to one that was available in the SDK previously. However, the previous sample did not adjust conversions for Daylight Savings Time. This sample does account for Daylight Savings time in the same way that the DateTime class itself accounts for it for local times. In fact, we used some of the same testing code to verify it.


 


..."


Timezones... sigh. Being in the EDD field, timezones & daylight savings time come up alot. Personally I think it’s time we kill Daylight Savings Time, but until then (and even after... sigh), I’ll have to deal with it.

Having it baked into the .Net Framework would help a great deal.

The above C# sample is pretty cool in that it avoids using interop to get its job done.

Technorati Tags: , , ,

No comments: