System.TimeZone

The TimeZone class encapsulates information about time zones and provides conversion utilities between local time and UTC time. Listing B.17 provides an example using TimeZone (timezone.cs).

Listing B.17. TimeZone Example
 public class TimeZoneMain { static void Main(string [] args) { TimeZone tz = TimeZone.CurrentTimeZone; Console.WriteLine("{0} {1} ", tz.DaylightName, tz.StandardName); DaylightTime dt = tz.GetDaylightChanges(DateTime.Now.Year); Console.WriteLine("Start daylight savings time {0} ", dt.Start); Console.WriteLine("End daylight savings time {0} ", dt.End); Console.WriteLine("Daylight savings time change {0} ", dt.Delta); Console.WriteLine("Is daylight savings? {0} ", tz.IsDaylightSavingTime(DateTime.Now)); Console.WriteLine("UTC ...

Get .NET Common Language Runtime Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.