Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change Date and Time

Status
Not open for further replies.

iambob

Programmer
Apr 13, 2021
41
US
What is the script to change the date and time in VBS? I need this for my programming finals, however we never learned it.
 
Seems odd that a programming finals might involve changing the system time and date. Even odder that you might want to try it in VBS, since VBS has no native capability to do this. One method (out of several) might be to shell out to the command line, ands run the date and/or time commands. eg

Code:
[COLOR=blue]strCommand = "cmd.exe /c time 23:02:00"
set objWshShell = WScript.CreateObject("WScript.Shell")
intRC = objWshShell.Run(strCommand, 0, TRUE)[/color]
 
Yeah it is odd. Thank you, though.

Sincerely,
Bob Space
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top