Day of the week: Difference between revisions
m
→{{header|RPL}}: add HP-48+ version
(Added PL/M) |
m (→{{header|RPL}}: add HP-48+ version) |
||
Line 5,105:
=={{header|RPL}}==
Early RPL versions do not have any date library, so a specific instruction implement Zeller's congruence with a stack-oriented algorithm.
{{works with|
≪ '''IF''' OVER 2 ≤ '''THEN''' 1 - SWAP 12 + SWAP '''END'''
100 MOD LAST / FLOOR
Line 5,111:
SWAP 1 + 13 * 5 / FLOOR + +
7 MOD 5 + 7 MOD 1 +
≫ '
In 1990, RPL gained some basic functions for calculating the date, but nothing for directly obtaining the day of the week.
{{works with|HP|48}}
≪ { "MON" TUE" "WED" "THU" "FRI" "SAT" "SUN" }
SWAP 0 TSTR 1 3 SUB POS
≫ '<span style="color:blue">WKDAY</span>' STO <span style="color:grey">@ ( dd.mmyyyy → 1..7 )</span>
≪ { } 2008 2121 '''FOR''' year
'''IF''' 25 12 year
≫ EVAL
{{out}}
|