Write a program to compute the date of Easter Sunday. Easter Sunday is the first Sunday after the first full moon of spring. Use the algorithm invented by the mathematician
VisualBasic Excel VBA Code
Function Easter_Sunday(Year)
k = Int(Year / 100) 'the secular number
s = 2 - Int((3 * k + 3) / 4) 'the secular sun control
m = 15 + Int((3 * k + 3) / 4) - Int((8 * k + 13) / 25) 'the secular moon circuit
a = Year Mod 19 'the lunar parameter
d = (19 * a + m) Mod 30 'the seed for the first full moon in spring
r = Int(d / 29) + (Int(d / 28) - Int(d / 29)) * Int(a / 11) 'the calendar correction amount
EB = 21 + d - r 'the Easter border
FS = 7 - (Year + Int(Year / 4) + s) Mod 7 'the first Sunday in March
ED = 7 - (EB - FS) Mod 7 'Easter distance in days
ESM = EB + ED - 1 'the date of Easter Sunday as the March date
'--------------------------------------- "For Years (1900-9999)" ------------------------------
Easter_Sunday = DateValue(1 & "." & 3 & "." & Year) + ESM
'--------------------------------------- "or for all Years" -----------------------------------
Month_ = 3 + Int(ESM / 31) 'Month March or April
ES = 1 + ESM Mod 31 'Eastersunday
Easter_Sunday = ("Su, " & Year & "." & Format(Month_, "00") & "." & Format(ES, "00"))
End Function