by Karthikeyan (187 Submissions)
Category: Windows API Call/Explanation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Wed 1st August 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Set System Time using SetSystemTime API
API Declarations
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
Private Declare Function SetSystemTime Lib "kernel32.dll" (lpSystemTime As SYSTEMTIME) As Long
' Set the system time to
' March 26, 1987 20:45:00 Greenwich Time
Dim stime As SYSTEMTIME
Dim rval As Long
stime.wHour = 20
stime.wMinute = 45
stime.wSecond = 0
stime.wMilliseconds = 0
stime.wDay = 26
stime.wMonth = 3
stime.wYear = 1987
' Set time and date.
rval = SetSystemTime(stime)
End
End Sub