Nissim Nissim - 2 years ago 100 Question

Detect if the DST is currently enabled

I need to find an easy way to know if the local machine's 'automatically adjust clock for Daylight Saving Time' option is enabled.
If the option's on, I need to know whether it is currently applied (i.e. is it DST currently in the system).
Thanks in advance

Answer Source

You can find the current system default time zone and whether it's currently using DST like this (.NET 3.5 onwards):

TimeZoneInfo zone = TimeZoneInfo.Local;
if (zone.SupportsDaylightSavingTime)
    Console.WriteLine("System default zone uses DST...");
    Console.WriteLine("In DST? {0}", zone.IsDaylightSavingTime(DateTime.UtcNow);
    Console.WriteLine("System default zone does not use DST.");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download