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.