Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
System Namespace
TimeZoneInfo Class
 Id Property

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
TimeZoneInfo..::.Id Property

Gets the time zone identifier.

Namespace:  System
Assembly:  System.Core (in System.Core.dll)
Visual Basic (Declaration)
Public ReadOnly Property Id As String
Visual Basic (Usage)
Dim instance As TimeZoneInfo
Dim value As String

value = instance.Id
C#
public string Id { get; }
Visual C++
public:
property String^ Id {
    String^ get ();
}
JScript
public function get Id () : String

Property Value

Type: System..::.String
The time zone identifier.

The time zone identifier is a key string that uniquely identifies a particular time zone. In Windows XP and Windows Vista, it corresponds to the subkeys of the HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Time Zone branch of the registry. It can be passed as a parameter to the FindSystemTimeZoneById method to retrieve a particular time zone from the registry.

Important noteImportant Note:

If you are defining a custom time zone, you should not assign it an identifier longer than 32 characters because this is the maximum length supported by the Windows registry.

The value of the Id property is usually, but not always, identical to that of the StandardName property. The identifier of the Coordinated Universal Time zone is UTC.

The following example lists the identifier of each of the time zones defined on the local computer.

Visual Basic
Dim zones As ReadOnlyCollection(Of TimeZoneInfo) = TimeZoneInfo.GetSystemTimeZones()
Console.WriteLine("The local system has the following {0} time zones", zones.Count)
For Each zone As TimeZoneInfo In zones
   Console.WriteLine(zone.Id)
Next

C#
ReadOnlyCollection<TimeZoneInfo> zones = TimeZoneInfo.GetSystemTimeZones();
Console.WriteLine("The local system has the following {0} time zones", zones.Count);
foreach (TimeZoneInfo zone in zones)
   Console.WriteLine(zone.Id);

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.

.NET Framework

Supported in: 3.5
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker