Time Zones in the .NET Framework [Anthony Moore]
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:
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.
For those of you that need Time Zone support, we are definitely interested in finding out what your scenarios are. Here are some examples of scenarios under discussion:
- Support for retrieving and changing the Local Time Zone.
- The ability to serialize Time Zone information, for example in the case of storing the information for a recurring meeting.
- Support for Time Zones with rules that change from year to year.
- Ability to pick up time zone data from the operating system.
- Ability to add a custom time zone.
- A data type with a DateTime and a Time Zone offset.
People are often not specific when they request Time Zone support, so if this is something you need, if you can clarify the specific scenarios that are valuable, it will help us build a better product.