Mega Code Archive

 
Categories / C# / Date Time
 

Display the names for standard time and daylight saving time for the local time zone

using System; using System.Globalization; class TimeZoneDemo {     static void Main( )     {         const string dataFmt = "{0,-30}{1}";         const string timeFmt = "{0,-30}{1:yyyy-MM-dd HH:mm}";         TimeZone localZone = TimeZone.CurrentTimeZone;         Console.WriteLine( dataFmt, "Standard time name:", localZone.StandardName );         Console.WriteLine( dataFmt, "Daylight saving time name:", localZone.DaylightName );     }  }