Jack Kelly
New Member
I see no benefit from anonymity.
Posts: 19
|
Easter
Jun 7, 2024 14:49:46 GMT -5
Post by Jack Kelly on Jun 7, 2024 14:49:46 GMT -5
Hello again, folks. In the old wiki, a member had posted a short routine to determine the date for Easter in any year. Is this code still available or does anyone have a copy? Thanks...
|
|
|
Easter
Jun 8, 2024 10:03:12 GMT -5
Post by Brandon Parker on Jun 8, 2024 10:03:12 GMT -5
Hello Jack, see if this subroutine suits your needs...
Call EasterDate month, day, 2025
Print month;" : ";day End
Sub EasterDate ByRef m, ByRef d, y FirstDig = Int(y/100) Remain19 = (y Mod 19)
temp = Int((FirstDig - 15)/2) + 202 - 11 * Remain19
Select Case FirstDig Case 21, 24, 25, 27, 28, 29, 30, 31, 32, 34, 35, 38 temp = (temp - 1) Case 33, 36, 37, 39, 40 temp = (temp - 2) End Select temp = temp Mod 30
tA = (temp + 21) If (temp = 29) Then tA = (tA - 1) If ((temp = 28) And (Remain19 > 10)) Then tA = (tA - 1)
tB = ((tA - 19) Mod 7)
tC = ((40- FirstDig) Mod 4) If (tC = 3) Then tC = (tC + 1) If (tC > 1) Then tC = (tC + 1)
temp = (y Mod 100) tD = ((temp + Int(temp/4)) Mod 7)
tE = ((20 - tB - tC - tD) Mod 7) + 1 d = (tA + tE)
If (d > 31) Then d = (d - 31) m = 4 Else m = 3 End If End Sub
{:0)
Brandon Parker
|
|
Jack Kelly
New Member
I see no benefit from anonymity.
Posts: 19
|
Easter
Jun 8, 2024 10:30:16 GMT -5
Post by Jack Kelly on Jun 8, 2024 10:30:16 GMT -5
Thank you for that, Brandon. I appreciate it. Your routine seems more complex than the one I remember from a few years back but it works. The algorithm is going to be complex in any case.
|
|
|
Easter
Jun 8, 2024 15:16:36 GMT -5
Post by tenochtitlanuk on Jun 8, 2024 15:16:36 GMT -5
Here is the original one from the Wiki by HarmonV two decades ago in 2007.. seems to work. I edited the spacing and layout a bit...
' Here is routine to calculate the date of easter given the year.
' Easter date Calculations. Program by HarmonV Feb 2007 ' In LB Wiki
global month$ month$ = "Jan Feb March April May June July Aug Sep Oct Nov Dec"
cls print print " This program will find the Gregorian date " print " on which Easter Sunday will occur." print " It's valid for any Gregorian year ( >=1583)."
do do input " Enter year (1583 to 4099, or 0 to exit): "; yy if yy =0 then stop loop until yy >1582 and yy <4100
easter$ = HVEaster$( yy) print " Easter will occur on "; easter$ input " Another date? (Y /N) : "; a$ print loop until ( upper$( a$) ="N")
print "Done."
end
function HVEaster$( yy) gn = yy mod 19 + 1 ' Golden Number c = int( yy /100) +1 ' Century JE = ( 11 *( gn -1)) mod 30 ' Julian Epact # S = int( 3 *c /4) ' Solar Equation ( 3 non-leap days every 4 centuries) L = int( ( 8 *c +5) /25) ' Lunar Equation ( 8 days every 25 centuries) GE = JE - S + L + 8 ' Gregorian Epact # if GE <1 then GE = GE + 30 *(1 +int( abs( GE) /30)) GE = GE mod 30
if GE <=23 then efm = 44 -GE ' efm = Ecclesiastical full moon ( 22=Mar 22nd, 32=Apr 1st, etc) if GE >23 then efm = 74 -GE if ( GE =24) or ( GE =25 and gn >11) then efm = efm - 1
wd =( efm + 2 + yy + int( yy /4) - int( yy /100) + int( yy /400) ) mod 7 ed =efm + 7 - wd ' Easter Day = first Sunday after EFM mm = 3 +int( ed /32) dd = ed - 31 *int( mm /4)
HVEaster$ = word$( month$, mm) +" "+ str$( dd) +", " +str$( yy) end function
|
|
Jack Kelly
New Member
I see no benefit from anonymity.
Posts: 19
|
Post by Jack Kelly on Jun 8, 2024 17:13:28 GMT -5
Again, my hearty thanks John, for digging up this old gem. We do all go back quite a few years, don't we? LOL.
|
|