Get TimeZoneInfo that represents the local time zone in CSharp

Description

The following code shows how to get TimeZoneInfo that represents the local time zone.

Example


/*from   w  w  w. j ava  2s .c  o m*/
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 »
    Data Types »




C# Data Types
Bool
Byte
Char
Decimal
Double
Float
Integer
Long
Short
String
C# Array
Array Example
Byte Array
C# Standard Data Type Format
BigInteger
Complex
Currency
DateTime
DateTimeOffset
DateTime Format Parse Convert
TimeSpan
TimeZone
Enum
Null
tuple
var