Absolute day numbers
Programming Features - Absolute Day Numbers (ADN)
The BBS system keeps track of the current date in the numeric variable DA as a value called an Absolute Day Number (ADN). An ADN is the number of days that have passed since January 1, 1800 (01/01/1800). This may seem inconvenient at first, but the Color 64 ML routines take care of all the necessary calculations, and you really don't even have to know that this is going on. You will never see an ADN when your BBS system is online, but you should know about this if you plan to program on your BBS system. ML functions @15 to @19 are all used to facilitate ADN calculations and conversions. For more information on what these functions do, consult section 5.1.8, "ML Function Summary".
The "current time" routine at line 1110 of an overlay is also used to calculate the current date when midnight has come. All it does is increase the variable DA by one and then use DA to get the value of DA$ and other information as well. The variable DA$ will hold the current date in the format "MM/DD/YYYY" where MM is the month (00 to 12), DD is the day (00 to 31), and YYYY is the year (1800 to 9999). The variable D1 will be the current month (1 to 12). The variable D2 will be the day of the week in the range 0 to 6 for Sunday to Saturday, respectively. The variable D3 will be the day of the month (0 to 31). The variable D4 will be the year (1800 to 9999).
The string array variables D1$ and D2$ can be used to convert a date into plain English format. The strings D1$(1) to D1$(12) hold the names of the twelve months of the year January to December. The strings D2$(0) to D2$(6) hold the names of the days of the week from Sunday to Saturday.
Other variables which are stored in ADN format are ED (caller's membership expiration date), LD (callers's last call date), and BD (caller's date of birth). Also, when the user's information is read in from their password record, the variables ED$, LD$, and BD$ will be set accordingly.
To find the difference in days between two dates, all you need to do is subtract the lower ADN from the higher ADN. This will be the exact number of days between the two dates. Also, to find out what the the current date would be after a certain number of days all you would need to do is add the number of days to the variable DA and you would have the new date.
There is also another function, @27, which can be used to find the number of calendar years between two dates. Using this function, you can quickly find the age of someone using the caller's date of birth, by using the format @27(DA,BD).
Next section: Using Disk Drives