Pacific Database

Home | Contact | FAQs | View Cart

A world of information at your fingertips

Date & Time :: Easter functions

On this page you will find several functions for calculating easter.

Easter Sunday

    dteEasterSunday=CDate(Clng(DateSerial(iYear, 4, 1) / 7 + _
	((19 * (iYear Mod 19) - 7) Mod 30) * 0.14) * 7 - 6)

Easter Sunday

    Public Function EasterSunday(dteCurrentDate As Date) As Date
        ' Ron Mallen - Astronomical Society of South Australia 1985
        ' (http://www.assa.org.au/edm.html#Computer)
        
        ' Calculates Easter Sunday from 1583 to 4099
        'Easter Sunday is the Sunday following the Paschal Full Moon (PFM) date for the year
        
        ' y is a 4 digit year 1583 to 4099
        ' d is the day of the month of Easter Sunday
        ' m is the month of Easter Sunday
        ' The \ operator means integer division - for example 30 \ 7 = 4
        '  (the remainder is ignored) 'All variables are integer data types
        
        Dim FirstDig, Remain19, temp    'intermediate results
        Dim tA, tB, tC, tD, tE          'table A to E results
        Dim y As Integer
        Dim m As Integer
        Dim d As Integer
        
        FirstDig = Year(dteCurrentDate) \ 100              'first 2 digits of year
        Remain19 = Year(dteCurrentDate) Mod 19             'remainder of year / 19
        
        ' Calculate PFM date
        temp = (FirstDig - 15) \ 2 + 202 - 11 * Remain19
        If FirstDig > 26 Then temp = temp - 1
        If FirstDig > 38 Then temp = temp - 1
        
        If ((FirstDig = 21) Or (FirstDig = 24) Or (FirstDig = 25) _
            Or (FirstDig = 33) Or (FirstDig = 36) Or (FirstDig = 37)) _
            Then temp = temp - 1
        
        temp = temp Mod 30
        
        tA = temp + 21
        If temp = 29 Then tA = tA - 1
        If (temp = 28 And Remain19 > 10) Then tA = tA - 1
        
        ' Find the next Sunday
        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 + temp \ 4) Mod 7
        
        tE = ((20 - tB - tC - tD) Mod 7) + 1
        d = tA + tE
        
        ' Return the date
        If d > 31 Then
            d = d - 31
            m = 4
        Else
            m = 3
        End If
        
        EasterSunday = DateSerial(Year(dteCurrentDate), m, d)
    End Function

Easter Saturday

    dteEasterSaturday = dteEasterSunday - 1
    dteEasterSaturday=CDate(Clng(DateSerial(iYear, 4, 1) / 7 + _
	((19 * (iYear Mod 19) - 7) Mod 30) * 0.14) * 7 - 6) - 1

Good Friday

    dteGoodFriday = dteEasterSunday - 2
    dteGoodFriday = dteEasterSaturday - 1
    dteGoodFriday = CDate(Clng(DateSerial(iYear, 4, 1) / 7 + _
	((19 * (iYear Mod 19) - 7) Mod 30) * 0.14) * 7 - 6) - 2