Older Version
Newer Version
harmonv
Mar 17, 2007
Here is routine to calculate the date of easter given the year.
[[code format="vbnet"]]
' Easter date Calculations
' program by HarmonV Feb 2007
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$
loop until (upper$(a$)="N")
print "Done."
end
' ----- end of main program ----
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
' efm = Ecclesiastical full moon (22=Mar 22nd, 32=Apr 1st, etc)
if GE<24 then efm = 44-GE
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
[[code]]