For the HP-32SII version, go here.
Written by Dave Coffin in March 2006.
(Program E was written on Easter 2006)
These operations are useful for any problem that depends on the exact interval between two dates. An all-integer C-language implementation may be found here in the set_date() and get_date() functions.
Program E calculates the date of Easter Sunday in any given year.
2006.0310 Today's date (Mar 10, 2006) XEQ C 732685 1965.0927 Your birthdate (Sep 27, 1965) XEQ C 717911 - 14774 Your age in days LASTx 717911 When will you be 20000 days old? 20000 + 737911 XEQ G 2020.063 FIX 4 2020.0630 June 30, 2020 XEQ E When's Easter Sunday that year? 737832 subtract 46 for Ash Wednesday, for example. XEQ G 2020.0412 Easter Sunday is April 12, 2020
In my system, Day 0 is March 1, 0 A.D (better known as 1 B.C.), or Julian day 1721120. Thus at 12:00 noon Universal Time on March 10, 2006, the Julian day was 1721120 + 732685 = 2453805.0.
Divide a day number by seven and take the remainder to determine the weekday. Zero is Wednesday.
C0001 LBL C C0002 0.88 ; stash this for RCL+ later C0003 STO Y C0004 R↓ C0005 ENTER ; copy the whole date C0006 FP ; discard the year C0007 0.0301 C0008 x>y? ; move New Year's Day from January 1 to March 1 C0009 RCL+ Y C0010 x<>y C0011 R↓ C0012 - C0013 STO Y ; save the new date C0014 FP ; month and day in Xreg C0015 STO- Y ; keep year only in Y C0016 100 C0017 × C0018 ENTER ; split month and day C0019 FP C0020 100 C0021 × C0022 x<>y C0023 IP ; Yreg = day, Xreg = month C0024 30.6 ; convert month to days C0025 × C0026 0.5 C0027 + C0028 IP C0029 + C0030 365.25 ; convert year to days C0031 RCL× Y C0032 IP C0033 + C0034 RCL Y ; centuries are not leap years... C0035 100 C0036 INT÷ C0037 - C0038 LASTx ; ...except those divisible by 400 C0039 4 C0040 INT÷ C0041 + C0042 RTN HP-33s: checksum = 6543, length = 234 HP-35s: checksum = 9B9B, length = 159
G0001 LBL G G0002 ENTER G0003 ENTER G0004 0.9 G0005 + G0006 36524.25 ; how many whole centuries? G0007 ÷ G0008 IP ; add one missing leap day per century G0009 + G0010 LASTx ; except for centuries divisible by 400 G0011 4 G0012 INT÷ G0013 - G0014 ENTER G0015 ENTER G0016 0.9 G0017 + G0018 365.25 ; compute the year G0019 ÷ G0020 IP G0021 STO Y G0022 365.25 ; keep the remaining days G0023 × G0024 IP G0025 - G0026 0.5 ; determine month and day G0027 + G0028 30.6 G0029 ÷ G0030 ENTER G0031 FP G0032 30.6 G0033 × G0034 IP G0035 100 G0036 ÷ G0037 x<>y G0038 IP G0039 + ; Xreg contains mm.dd G0040 88 G0041 x<> Y ; move New Year's Day from March 1 to January 1 G0042 x<>y G0043 10 G0044 x≤y? ; "≤" means "less than or equal to" G0045 RCL+ Y G0046 + G0047 6.99 G0048 - G0049 100 ; combine mm.dd value with year G0050 ÷ G0051 + G0052 RTN HP-33s: checksum = 72FE, length = 324 HP-35s: checksum = 94BD, length = 208
E0001 LBL E E0002 IP ; save the integer year E0003 STO Y E0004 19 ; apply the Meeus/Jones/Butcher algorithm E0005 RMDR E0006 19 E0007 × E0008 RCL Y E0009 100 E0010 INT÷ E0011 + E0012 LASTx E0013 LASTx E0014 8 E0015 + E0016 25 E0017 INT÷ E0018 - E0019 1 E0020 + E0021 3 E0022 INT÷ E0023 - E0024 RCL Y E0025 400 E0026 INT÷ E0027 - E0028 15 E0029 + E0030 30 E0031 RMDR ; days from March 22 to ecclesiastical full moon E0032 STO Z E0033 0.0322 E0034 RCL+ Y E0035 XEQ C ; day number for March 22, year Y E0036 + ; day number for full moon E0037 ENTER E0038 ENTER E0039 4 E0040 x<>y E0041 - E0042 7 E0043 RMDR ; days from full moon to the following Sunday E0044 x<> Z E0045 11 E0046 × E0047 22 E0048 RCL× Z E0049 + E0050 RCL Y E0051 19 E0052 RMDR E0053 + E0054 451 ; for April 26 and sometimes April 25, E0055 INT÷ ; go back seven days E0056 -7 E0057 × E0058 RCL+ Z E0059 + E0060 RTN ; GTO G instead converts day number to date HP-33s: checksum = E175, length = 396 HP-33s: checksum = 6084 if the last line is "GTO G" HP-35s: checksum = 01F0, length = 218 HP-35s: checksum = 9DEA, length = 248 if the last line is "GTO G"