Use VBS to change the system time after 03:14:07, January 1, January 19, 2038, so that some programs dependent on Unix timestamps may have problems. So how to use VBS to modify the system time? On that day, I talked to others about Y2K38, So I thought of a prank: I used VBS to modify the system time after 03:14:07 on January 1, January 19, 2038, in this way, some programs that depend on Unix timestamps may have problems. So how can we use VBS to modify the system time?
The simplest and least technical method is to call the date and time commands of cmd:
'Author: Demon 'Website: http://demon.tw 'Date : 2011/4/27 Dim WshShell Set WshShell = CreateObject("wscript.Shell") WshShell.Run "cmd.exe /c date 2038-01-19", 0 WshShell.Run "cmd.exe /c time 3:14:08", 0
A more technical method is to use the SetDateTime method of the WMI Win32_OperatingSystem class:
'Author: demo' Website: http://demon.tw 'date: 2011/4/27 dtmNewDateTime = "20380119031408.000000 + 480" 'utc time strComputer = ". "Set ob1_miservice = GetObject (" winmgmts: {(Systemtime) }\\ "& strComputer &" \ root \ cimv2 ") Set colOSes = ob1_miservice. execQuery ("Select * From Win32_OperatingSystem") For Each objOS In colOSes objOS. setDateTime dtmNewDateTime Next
Windows 7 requires administrator privileges to enable UAC to modify the time.
For more information about how to use VBS to modify (SET) the system time and date code, see PHP!