Date, Date$ (statements)

Syntax Date[$] = newdate
Description Sets the system date to the specified date.
Comments The Date$ statement requires a string variable using one of the following formats:   MM-DD-YYYY   MM-DD-YY   MM/DD/YYYY   MM/DD/YY, Where MM is a two-digit month between 1 and 31, DD is a two-digit day between 1 and 31, and YYYY is a four-digit year between 1/1/100 and 12/31/9999. The Date statement converts any expression to a date, including string and numeric values. Unlike the Date$ statement, Date recognizes many different date formats, including abbreviated and full month names and a variety of ordering options. If newdate contains a time component, it is accepted, but the time is not changed. An error occurs if newdate cannot be interpreted as a valid date.
Example This example saves the current date to Cdate$, then changes the date and displays the result. It then changes the date back to the saved date and displays the result.
Const crlf = Chr$(13) + Chr$(10)
Sub Main()
  TheDate$ = Date
  Date = "01/01/95"
  MsgBox "Saved date is: " & TheDate$ & crlf & "Changed date is: " & Date
  Date = TheDate$
  MsgBox "Restored date to: " & TheDate$
End Sub
See Also Date, Date$ (functions); Time, Time$ (statements).
Notes If you do not have permission to change the date, runtime error 70 will be generated.