SuperBasic can use the environment variable DATE$, which contains the system date and time in the following format:
1991 May 06 18:18:44
This value can be used as a string or be used for date manipulation.
It is possbile to pass an integer value to this variable, containing the number of seconds to be added to the initial date (1/1/1961).
PRINT DATE$(0) e.g. will return
1961 Jan 01 00:00:00,
while PRINT DATE$(10) will return
1961 Jan 01 00:00:10.
This means that if you want, for example, to use an interval of a few days you will have to use a multiple of 86400 (the number of seconds in a day).
It is possible to use the TO function on the string returned by DATE$. As an example, you can achieve the stored year by using
YEAR = DATE$ (1 TO 4)
Another environment variable, called DATE, returns an integer value containing the number of seconds passed since 1961 January 1: this means that DATE$(DATE) will return the current date.
Using this variable we can calculate time intervals (e.g. every day would be 86400 seconds long) without having to care for the days in a month, bisextile years, or the like.
Another way to use DATE is to pass this variable a 6 values array, which can be used as a system date. Passing, for example, this
these values will be treated as a system date, without having to convert it in seconds since 1961/1/1. In this case, we are showing the maximum date value allowed on the QL: January 19, 2029, h3:14 and 7 seconds. From then on, the clock will restart from January 1, 1961.