'''This page is maintained for historic purposes. The keyword is not supported in QB64. Reading the current date is supported with the [[DATE$|DATE$ function]].'''

----

The [[DATE$]] statement sets the current computer date to another [[STRING]] value.


{{PageSyntax}}
: [[DATE$]] = {{Parameter|stringExpression$}}

* {{Parameter|stringExpression$}} can use slash or dash as separators:

::::mm-dd-yyyy
::::mm/dd/yyyy

* String expression or variable must contain the month, day and 4 digit year to be changed (10 valid characters). 
* If value is not a valid formatted string, a "Type Mismatch" error results. The previous DATE$ value will be retained.
* The current date (as assigned when the operating system was initialized) can be saved to restore later with the [[DATE$]] function.
*The DATE$ function returns a 10-character string in the form ''mm-dd-yyyy''. ''mm'' is the month (01 to 12), ''dd'' is the day (01 to 31), and ''yyyy'' is the four digit year.
* '''Note: Some systems may not allow the DATE to be reset or require Administrator privileges.''' Try a batch file or [[SHELL]].


{{PageExamples}}
''Example:'' Backdating computer to run old software.

{{CodeStart}}
 today$ = {{Cl|DATE$}}         ' function saves current computer date value
 PRINT today$           ' verify actual date
 {{Cl|DATE$ (statement)|DATE$}} = "12-25-2000"   ' literal statement changes date 
 PRINT {{Cl|DATE$}}            ' verify new date setting
 {{Cl|SHELL}} "CMD /C " + programfile$    'run old program
 K$ = {{Cl|INPUT$}}(1)         ' press a key
 DATE$ = today$         ' statement resets computer to original date later in program
 PRINT {{Cl|DATE$}}            ' verify present setting
{{CodeEnd}}

{{OutputStart}}
 09-01-2009
 12-25-2000
 09-01-2009
{{OutputEnd}}



{{PageSeeAlso}}
[[DATE$]], [[TIME$]], [[TIME$ (statement)]]


{{PageNavigation}}
