Monday, October 4, 2010

Retrieving the current time zone information

Here is the simple code snippet to find out the current time zone

Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SYSTEM\CurrentControlSet\Control\TimeZoneInformation"
strValueName = "StandardName"
oReg.GetExpandedStringValue HKEY_LOCAL_MACHINE,strKeyPath, strValueName,strValue
Set oReg=Nothing
Msgbox(strValue)

No comments:

Post a Comment