Question:
How can I retrieve the Offset set up at the computer so that I can calculate the time according to UTC/GMT?
Solution:
Via VBScript, you can retrieve the Offset value set up at Windows Registry.
Example:
DateTime = now()
set Shell = CreateObject(“WScript.Shell”)
atb = “HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation\ActiveTimeBias”
offsetMin = Shell.RegRead(atb)
msgbox “Offset in Minutes = ” & offsetMin
UTC = DateAdd(“n”, offsetMin, DateTime) ‘Adds Offset to current DateTime
msgbox “Current = ” & DateTime & ” — UTC = ” & UTC
set Shell = CreateObject(“WScript.Shell”)
atb = “HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation\ActiveTimeBias”
offsetMin = Shell.RegRead(atb)
msgbox “Offset in Minutes = ” & offsetMin
UTC = DateAdd(“n”, offsetMin, DateTime) ‘Adds Offset to current DateTime
msgbox “Current = ” & DateTime & ” — UTC = ” & UTC