Rpbasic-52 programming guide, Date – Remote Processing BASIC 52 User Manual
Page 45

RPBASIC-52 PROGRAMMING GUIDE
2-26
DATE
(function)
Syntax:
A = DATE(n)
Where: n = 0 to 3
0 = year (last two digits)
1 = mon th
2 = day
3 = day of week
Function:
Returns the month, day, day of week, or year from the optional real time clock
Mode:
Comm and, Run
Use:
A=D ATE (2)
Returns day of month
Cards:
All. Note exceptions for RPC-52.
D E S C R IP T I ON
A DS1216DM must be in the RAM socket. Consult your hardware manual for location. A numerical value
of the month, day, or year is returned. The program under the TIME function is used to convert numerical
date to a string. Substitute DATE for TIME in the program. STR function 10 also converts a number to a
string.
A HAR DWA RE error is returned if the RTC is missing or bad. Use the ONERR construct to trap a defective
DS1216DM . Hardware error code at address 101H is 50.
Day of we ek is re turned only on cards w hich u se a D S121 6DM clock mod ule. (T his exc ludes t he R PC-5 2.)
RELATED
D A T E (c o mm a nd ), TI M E
ERRORS
BAD ARGUMENT When n out of range or negative
H A R D W A R E
RTC module missing or bad
EXAMPLE
100 PRINT "Time: ",
110 FOR N=0 TO 2
120
PRINT TIME(N),
130 NEXT
140 PRINT " Date: ",
150 FOR N=0 TO 3
160 PRINT DATE(N),
170
NEXT
180
PRINT CR,
190
GOTO 100
run
Time: 13 24 12 Date: 94 11 14 3