Represents any time zone in the world.
Assembly: System.Core (in System.Core.dll)
The HostProtectionAttribute attribute applied to this type or member has the following Resources property value: MayLeakOnAbort. The HostProtectionAttribute does not affect desktop applications (which are typically started by double-clicking an icon, typing a command, or entering a URL in a browser). For more information, see the HostProtectionAttribute class or SQL Server Programming and Host Protection Attributes.
A time zone is a geographical region in which the same time is used.
The class offers significant enhancements over the TimeZone class, which provides only limited functionality.
The TimeZone class recognizes only the local time zone, and can convert times between Coordinated Universal Time (UTC) and local time. A object can represent any time zone, and methods of the class can be used to convert the time in one time zone to the corresponding time in any other time zone. The members of the class support the following operations:
Retrieving a time zone that is already defined by the operating system.
Enumerating the time zones that are available on a system.
Converting times between different time zones.
Creating a new time zone that is not already defined by the operating system.
Serializing a time zone for later retrieval.
An instance of the class is immutable. Once an object has been instantiated, its values cannot be modified.
You cannot instantiate a object using the new keyword. Instead, you must call one of the static members of the class shown in the following table.
Static member name
Creates a custom time zone from application-supplied data.
Instantiates a time zone defined in the system registry based on the zone's identifier.
Deserializes a string value to re-create a previously serialized object.
Returns an enumerable ReadOnlyCollection(T) of objects that represents all time zones that are available on the local system.
Instantiates a object that represents the local time zone.
Instantiates a object that represents the UTC zone.
You can use the CreateCustomTimeZone method to create a time zone that is not defined in the local system registry. You can then use the ToSerializedString property to save the time zone object's information as a string, which can be stored in some form that is accessible to the application. You can use the FromSerializedString method to convert a serialized string back to a object.
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.