Time and Date Functions
Functions for retrieving and manipulating time and date information from the system clock.
Date Functions
DATE$
Returns the current date based on MMBasic’s internal clock as a string in the form "DD-MM-YYYY". For example, "28-07-2012".
DATETIME$(n)
Returns the date and time corresponding to the epoch number n (number of
seconds that have elapsed since midnight GMT on January 1, 1970).
The format of the returned string is “dd-mm-yyyy hh:mm:ss”. Use the text NOW to get the current datetime string, ie, DATETIME$(NOW)
DAY$(date$)
Returns the day of the week for a given date as a string.
For example, “Monday”, “Tuesday” etc.
date$ is a string and its format can be DD-MM-YY or DD-MM-YYYY or
YYYY-MM-DD. You can also use NOW to get the day for the current date,
eg, PRINT DAY$(NOW)
Time Functions
TIMER
Returns the elapsed time in milliseconds (eg, 1/1000 of a second) since reset.
The timer is reset to zero on power up or a CPU restart and you can also reset it by using TIMER as a command. If not specifically reset it will continue to count up forever (it is a 64 bit number and therefore will only roll over to zero after 200 million years).
Time System Functions
EPOCH(DATETIME$)
Returns the epoch number (number of seconds that have elapsed since midnight GMT on January 1, 1970) for the supplied DATETIME$ string.
The format for DATETIME$ is “dd-mm-yyyy hh:mm:ss”, “dd-mm-yy hh:mm:ss”, or “yyyy-mm-dd hh:mm:ss”,. Use NOW to get the epoch number for the current date and time, i.e. PRINT EPOCH(NOW)