Search code examples
windowswmidst

Check for daylight saving time with WMI on Vista/Win7


How do I find out if the computer I'm on has daylight saving time in effect? (preferably using WMI)

According to this article at TechNet, I could query SELECT DaylightInEffect FROM Win32_ComputerSystem, but the property DaylightInEffect is not supported on Vista or Win7. As my program will run on various systems (XP, Vista, 7), I would appreciate some portable way of finding out.


Solution

  • The documented supported OS list is not accurate, this works fine on Win7 when I try it. I can't think of any reason it wouldn't be supported on any other OS, it is easy to find out with the Win32 API (GetTimeZoneInformation).

    You can use WmiCodeCreator for a quick check.