Day of the week: Difference between revisions

Content added Content deleted
(Added PL/M)
m (→‎{{header|RPL}}: add HP-48+ version)
Line 5,105: Line 5,105:
=={{header|RPL}}==
=={{header|RPL}}==
Early RPL versions do not have any date library, so a specific instruction implement Zeller's congruence with a stack-oriented algorithm.
Early RPL versions do not have any date library, so a specific instruction implement Zeller's congruence with a stack-oriented algorithm.
{{works with|Halcyon Calc|4.2.7}}
{{works with|HP|28}}
≪ '''IF''' OVER 2 ≤ '''THEN''' 1 - SWAP 12 + SWAP '''END'''
≪ '''IF''' OVER 2 ≤ '''THEN''' 1 - SWAP 12 + SWAP '''END'''
100 MOD LAST / FLOOR
100 MOD LAST / FLOOR
Line 5,111: Line 5,111:
SWAP 1 + 13 * 5 / FLOOR + +
SWAP 1 + 13 * 5 / FLOOR + +
7 MOD 5 + 7 MOD 1 +
7 MOD 5 + 7 MOD 1 +
≫ ''''WKDAY'''' STO
≫ '<span style="color:blue">WKDAY</span>' STO
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
≪ { } 2008 2121 '''FOR''' year
'''IF''' 25 12 year '''WKDAY''' 7 == '''THEN''' year + '''END NEXT'''
'''IF''' 25 12 year <span style="color:blue">WKDAY</span> 7 == '''THEN''' year + '''END NEXT'''
≫ EVAL
≫ EVAL
{{out}}
{{out}}