I need to have a vbscript run every hour. This script need to dynamically get the previous UTC hour.
Example If it runs at 9 AM Est I need it to return: 8amUTC and 9am UTC.
I can create the timestamps well enough but when I try to use them I don't think that the system is looking at them as valid date formats. If I hardcode the values into the script it will work. So I must be creating these incorrectly. Does anyone have a better solution than how I am doing this?
Code:od = now() set oShell = CreateObject("WScript.Shell") atb = "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation\ActiveTimeBias" offsetMin = oShell.RegRead(atb) nd = dateadd("n", offsetMin, od) StartTime = Year(Date)&"-" & Month(Date)&"-"&Day(Date)&"T"&(Hour(nd)-1)&":00:00Z" EndTime = Year(Date)&"-" & Month(Date)&"-"&Day(Date)&"T"&Hour(nd)&":00:00Z" 'StartTime ="2010-11-01T19:00:00.00Z" 'EndTime="2010-11-01T20:00:00.00Z" wscript.echo StartDate wscript.echo EndDate




Reply With Quote