C# TimeZoneInfo Local
Description
TimeZoneInfo Local
gets a TimeZoneInfo object that represents
the local time zone.
Syntax
TimeZoneInfo.Local
has the following syntax.
public static TimeZoneInfo Local { get; }
Example
The following example retrieves a TimeZoneInfo object that represents the local time zone and outputs its display name, standard time name, and daylight saving time name.
/*from w w w . j a v a2 s.c om*/
using System;
public class MainClass{
public static void Main(String[] argv){
TimeZoneInfo localZone = TimeZoneInfo.Local;
Console.WriteLine("Local Time Zone ID: {0}", localZone.Id);
Console.WriteLine(" Display Name is: {0}.", localZone.DisplayName);
Console.WriteLine(" Standard name is: {0}.", localZone.StandardName);
Console.WriteLine(" Daylight saving name is: {0}.", localZone.DaylightName);
}
}
The code above generates the following result.