|
-
Nov 3rd, 2010, 10:23 PM
#1
Thread Starter
Fanatic Member
UTC Date trouble
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
"...Men will still say THIS was our finest hour"
If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?
-
Nov 7th, 2010, 06:50 AM
#2
Re: UTC Date trouble
Maybe using DateSerial function or CDate function to convert the dates, will help
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|