< Public Function EasterDate (YearToCalculate As Integer) As Date (?)
Comments'------------------------------------------------------------------- 'Function to calculate easter for a given year '-------------------------------------------------------------------
Public Function EasterDate (YearToCalculate As Integer) As Date
Dim CurrentCentury As Integer
Dim YearMod19 As Integer
Dim Temp As Variant
Dim tA As Integer
Dim tB As Integer
Dim tC As Integer
Dim Temp2 As Variant
Dim tD As Integer
Dim tE As Integer
Dim EasterDayOfMonth As Integer
'Store the number of the current century
CurrentCentury = Int(YearToCalculate / 100)
'Determine the approximate place in the 19-year solunar cycle
YearMod19 = Int(Remainder(YearToCalculate, 19))
'calculate PFM date
Temp = Int((CurrentCentury - 15) / 2) + 202 - (11 * YearMod19)
'Insert leap days to fiddle the solunar cycle to make it 19 years
If (CurrentCentury > 26) Then
Temp = -1
End If
Select Case CurrentCentury
Case 21, 24, 25:
Temp = -1
Case Else:
End Select
Temp = Remainder(Temp, 30)
tA = Temp + 21
If Temp = 29 Then
tA = tA - 1
End If
If (Temp = 28) And (YearMod19 > 10) Then
tA = tA - 1
End If
'find the next Sunday
tB = Remainder((tA - 19), 7)
'fix the leap years in 1 of every 4 ceuturies
tC = Remainder((40 - CurrentCentury), 4)
If tC = 3 Then
tC = tC + 1
End If
If tC > 1 Then
tC = tC + 1
End If
Temp = Remainder(YearToCalculate, 100)
Temp2 = CStr(Temp / 4)
If Mid(Temp2, 1, 1) = "." Then
Temp2 = "0" & Temp2
End If
Temp2 = Int(Temp2)
'Find the next sunday
tD = Remainder((Temp + Temp2), 7)
tE = Remainder((20 - tB - tC - tD), 7) + 1
'Calculate the number of days since the beginning of march
EasterDayOfMonth = tA + tE
'Convert to a VB date format
EasterDate = CDate("1 march " & CStr(YearToCalculate)) + EasterDayOfMonth - 1
End Function