DATE$ (statement) - QB64 Wiki

DATE$ (statement)

From QB64 Wiki

Jump to: navigation, search

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

Syntax: DATE$ = String_expression

  • String expression can use slash or dash formats when assigning the date:
  • String expression or variable must contain the months, 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.
  • Keyword Not Supported in Linux or MAC versions

Example: Backdating computer to run old software.

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

09-01-2009 12-25-2000 09-01-2009

See also:

DATE$, TIME$, TIME$ (statement)

Go to Keyword Reference - Alphabetical
Go to Keyword Reference - By usage
Go to Main WIKI Page
  • Page
  • Discussion
  • View source
  • History
Personal tools
  • Log in
  • What links here
  • Related changes
  • Special pages
  • Printable version