Altering the System Date

Setting the system date and time can be jolly useful.

Whether you're attempting to synchronise all the computer clocks on your network or merely trying to create a program to help dodge shareware nag screens, this groovy code snippet can help.

To set the system date, call the SetDate method, passing a new date. To set the system time, call the SetTime method, passing a new time.

This code works by actually setting the Date and Time properties, functionality most programmers aren't aware of.

Usage

SetDateTime ("August 1 2000")
SetDateTime ("01/08/2000")
SetTime (#1:00:00 PM#)

Code

Public Sub SetDate(NewDate As Variant)

    On Error Resume Next

    DateTime.Date = NewDate

End Sub

Public Sub SetTime(NewTime As Variant)

    On Error Resume Next

    DateTime.Time = NewTime

End Sub


Head of Household Life Insurance | International Merchant Account Processing | Necklace | Free Flash Games | Shades