Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


change time script

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,25803
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> change time script
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 change time script - 9/10/2005 5:28:22 AM   
  hawkeen

 

Posts: 1
Score: 0
Joined: 9/10/2005
Status: offline
Hello,

I have done some digging but have not found a way to add time to the display time on the computer. For example, I wish to add 3 hours to the current time but have not been able to accomplish this.  I found the script which adjusts for greenwich offset but that did not work. This seems like a simply problem but I am at a loss. Any help would be appreciated.

cheers
Hawk
 
 
Post #: 1
 
 RE: change time script - 9/10/2005 6:30:25 AM   
  Snipah


Posts: 1343
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
Hiya,



Please post you current script, so we can build upon it...




_____________________________

For more information, please see the "Read me First" topic.

http://www.visualbasicscript.com

(in reply to hawkeen)
 
 
Post #: 2
 
 RE: change time script - 9/10/2005 7:37:21 PM   
  maneich

 

Posts: 16
Score: 0
Joined: 5/20/2005
From:
Status: offline
Hello,

try this

x = DateAdd("h", 3, Now)
newTime = right(x, 8)
WScript.Echo newTime

regards maneich

(in reply to Snipah)
 
 
Post #: 3
 
 RE: change time script - 9/11/2005 11:28:06 PM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
Using the above script, the time is changed from 8:26 AM to 25:26.  I changed Now to  Time, removed the RIGHT and it worked for me.

strNow = Time
 x = DateAdd("h", 3, strNow)
newTime = x'right(x, 8)
WScript.Echo "Original Time = " & strNow & vbcr & "New Time = " & newTime

All you would need to do is use the TIME cmd to set it

i.e.
WshShell.Run "cmd /C Time " & NewTime,1,TRUE

_____________________________

Mike

For useful Scripting links see the Read Me First stickey!

Always remember Search is your friend.

(in reply to maneich)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> change time script Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts