C# TimeZoneInfo Id

Description

TimeZoneInfo Id gets the time zone identifier.

Syntax

TimeZoneInfo.Id has the following syntax.


public string Id { get; }

Example

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


using  System.Collections.ObjectModel;
using System;//  w  w w.jav  a  2s  . c o m
public class MainClass{
  public static void Main(String[] argv){  
    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);

  }
}
    

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version