TimeZoneInformation – Any time zone to IST conversion Classic ASP

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation Windows server registry key and its field ActiveTimeBias will return the offset in minutes from GMT for the machine that you are running on.

 currentdateandtime = now() 
  set oShell = CreateObject("WScript.Shell") 
    windowregistrykey = "HKEY_LOCAL_MACHINE\System\CurrentControlSet\" &_ 
        "Control\TimeZoneInformation\ActiveTimeBias" 
'offset from UTC for the time zone that your server is set to    
offsetMin = oShell.RegRead(atb) 
  
  newdatetime = dateadd("n", offsetMin, od) 

    ISTtime=DateAdd("n",330,newdatetime)

response.Write offsetMin & "offset <br>"
response.Write od  & " currentdateandtime<br>"
response.Write newdatetime & "adding OffsetMin<br>"
response.Write ISTtime & "adding 330 to above<br>"

On AZURE Cloud registry value will give error

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation\ActiveTimeBias

Leave a Reply

Your email address will not be published. Required fields are marked *