CurrentDate$ ( )
Parameters
| None. |
Description
|
Returns today's date as a string. The format is fixed: day, short month name, four-digit year, separated by spaces - "29 Aug 2026". It comes from the machine's local time, so it reflects the player's own clock and time zone. This is the command for stamping things: the date on a save game slot, a line in a debug log, the filename of a screenshot, or a "last played" record. Combined with CurrentTime you get a complete human-readable timestamp. Because the format never changes you can pull the pieces out reliably with Left, Mid and Right - the year is always the last four characters, for instance. It is not a sortable format, though, so if you need to order save slots by date, store a number from MilliSecs or your own encoding alongside it. Do not use this for timing anything inside your game. It only changes once a day; MilliSecs is what you want for elapsed time. See also: CurrentTime, MilliSecs, Str. |
Example
; CurrentDate Example ; ------------------- ; CurrentDate$ returns the system date as a string ; in the format DD MON YYYY, e.g. "10 DEC 2000". today$=CurrentDate$() Print "Today is "+today$ Print "" ; Handy for stamping save games and log files Print "Save stamp: quest.sav ("+today$+" "+CurrentTime$()+")" Print "" ; The fixed format makes the parts easy to slice out Print "Day: "+Left$(today$,2) Print "Month: "+Mid$(today$,4,3) Print "Year: "+Right$(today$,4) Print "" Print "Press any key to close the example" WaitKey End
Index