Finding the Time Zones Defined on a Local System
The TimeZoneInfo class does not expose a public constructor. As a result, the new keyword cannot be used to create a new TimeZoneInfo object. Instead, TimeZoneInfo objects are instantiated either by retrieving information on predefined time zones from the registry or by creating a custom time zone. This topic discusses instantiating a time zone from data stored in the registry. In addition, static (shared in Visual Basic) properties of the TimeZoneInfo class provide access to Coordinated Universal Time (UTC) and the local time zone.
For time zones that are not defined in the registry, you can create custom time zones by calling the overloads of the CreateCustomTimeZone method. Creating a custom time zone is discussed in the How to: Create Time Zones Without Adjustment Rules and How to: Create Time Zones with Adjustment Rules topics. In addition, you can instantiate a TimeZoneInfo object by restoring it from a serialized string with the FromSerializedString method. Serializing and deserializing a TimeZoneInfo object is discussed in the How to: Save Time Zones to an Embedded Resource and How to: Restore Time Zones from an Embedded Resource topics.
The TimeZoneInfo class provides two predefined time zone objects that represent the UTC time and the local time zone. They are available from the Utc and Local properties, respectively. For instructions on accessing the UTC or local time zones, see How to: Access the Predefined UTC and Local Time Zone Objects.
You can also instantiate a TimeZoneInfo object that represents any time zone defined in the registry. For instructions on instantiating a specific time zone object, see How to: Instantiate a TimeZoneInfo Object.
The time zone identifier is a key field that uniquely identifies the time zone. While most keys are relatively short, the time zone identifier is comparatively long. In most cases, its value corresponds to the TimeZoneInfo.StandardName property, which is used to provide the name of the time zone's standard time. However, there are exceptions. The best way to make sure that you supply a valid identifier is to enumerate the time zones available on your system and note their associated identifiers.