Change System Date

This code will change your system date to certain date you wanted to.

Private Type SYSTEMTIME
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" (lpSystemTime As SYSTEMTIME) As Long

Private Sub Form_Load()

Dim lpSystemTime As SYSTEMTIME

lpSystemTime.wYear = 2003
lpSystemTime.wMonth = 10
lpSystemTime.wDayOfWeek = -1
lpSystemTime.wDay = 10
lpSystemTime.wHour = 0
lpSystemTime.wMinute = 0
lpSystemTime.wSecond = 0
lpSystemTime.wMilliseconds = 0

'set the new time
SetSystemTime lpSystemTime
End Sub

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: