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


"HTTP/1.1 200 OK Date: Fri, 09 May 2008 21:59:16 GMT Server: Apache/1.3.33 (Unix) mod_perl/1.29 Connection: close Transfer-Encoding: chunked Content-Type: text/html; charset=iso-8859-1 200 OK

OK

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@lics.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.