tags:

views:

130

answers:

1

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.

+1  A: 

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.

Hans Passant
Indeed, it seems to work in practice. Yay for undocumented API.
Piskvor