在Vista / Win7上使用WMI检查夏令时 [英] Check for daylight saving time with WMI on Vista/Win7

查看:128
本文介绍了在Vista / Win7上使用WMI检查夏令时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何确定我所在的计算机是否具有夏令时有效? (最好使用WMI)

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

根据这篇在TechNet上的文章,我可以查询 SELECT Winlight_Effect from Win32_ComputerSystem ,但是属性 DaylightInEffect 。由于我的程序可以在各种系统(XP,Vista,7)上运行,因此,我希望能找到一些可移植的方法。

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.

推荐答案

已记录的受支持的操作系统列表不正确,当我尝试使用Win7时,此方法可以正常工作。我想不出任何其他操作系统都不会支持它的原因,使用Win32 API(GetTimeZoneInformation)很容易找到它。

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).

您可以使用 WmiCodeCreator 快速检查。

这篇关于在Vista / Win7上使用WMI检查夏令时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆