Mega Code Archive

 
Categories / C# Book / 02 Essential Types
 

0277 Current TimeZone

TimeZone.CurrentTimeZone method returns a TimeZone object based on the current local settings. using System; using System.Text; class Sample { public static void Main() { TimeZone zone = TimeZone.CurrentTimeZone; Console.WriteLine(zone.StandardName); Console.WriteLine(zone.DaylightName); } } The output: Pacific Standard Time Pacific Daylight Time