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.





















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