by FabioMan (1 Submission)
Category: Math/Dates
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Originally Published: Thu 17th October 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Function to compute easter day. Pass a year as integer, get a serial date.
' Pass year as 4dgts number
' Returns a DateSerial
' VB translation from C by [email protected]
' Source:
' http://www.oremus.org/liturgy/etc/ktf/app/easter.html
' and its link to http://www.ely.anglican.org/etc/easter2.c
' Simple EASTER date programme
' ============================
' Computes the date of Easter, according to the Gregorian
' calendar (for years after 1752) or the Julian Calendar
' (for years before 1753).
' Simon Kershaw: 29.Jan, 1996, 2.Feb.1996.
'
'
'
' Copyright (c) Simon Kershaw 1996. All rights reserved.
' ================================= ====================
' This code may be reproduced and used, without fee,
' in part or in full provided the copyright notice and
' these conditions are distributed with it. No fee,
' other than recovery of reasonable costs, may be
' charged without explicit permission from the
' author, Simon Kershaw, <[email protected]>.
' All rights reserved.
'
'
'
' The date of Easter Day was defined by the Council of
' Nicaea in AD325 as the Sunday after the first full moon
' which falls on or after the Spring Equinox. The
' Equinox is assumed to always fall on 21st March, so the
' calculation reduces to determining the date of the full
' moon and the date of the following Sunday. The algorithm
' used here was introduced around the year 532 by Dionysius
' Exiguus. Under the Julian Calendar a simple 19-year
' cycle is used to track the phases of the Moon. Under the
' Gregorian Calendar (devised by Clavius and Lilius, and
' introduced by Pope Gregory XIII in October 1582, and into
' Britain and its then colonies in September 1752) two
' correction factors are added to make the cycle more
' accurate.
'
Dim golden As Integer
Dim solar As Integer
Dim lunar As Integer
Dim pfm As Integer
Dim dom As Integer
Dim tmp As Integer
Dim easter As Integer
' the Golden number */
golden = (iYear Mod 19) + 1
If iYear <= 1752 Then
' JULIAN CALENDAR */
' the "Dominical number" - finding a Sunday */
dom = (iYear + (iYear \ 4) + 5) Mod 7
If dom < 0 Then dom = dom + 7
' uncorrected date of the Paschal full moon */
pfm = (3 - (11 * golden) - 7) Mod 30
If (pfm < 0) Then pfm = pfm + 30
Else
' GREGORIAN CALENDAR */
' the "Dominical number" - finding a Sunday */
dom = (iYear + (iYear \ 4) - (iYear \ 100) + (iYear \ 400)) Mod 7
If (dom < 0) Then dom = dom + 7
' the solar and lunar corrections */
solar = (iYear - 1600) \ 100 - (iYear - 1600) / 400
lunar = (((iYear - 1400) \ 100) * 8) \ 25
' uncorrected date of the Paschal full moon */
pfm = (3 - (11 * golden) + solar - lunar) Mod 30
If (pfm < 0) Then pfm = pfm + 30
End If
' corrected date of the Paschal full moon - days after 21st March */
If ((pfm = 29) Or (pfm = 28 And golden > 11)) Then pfm = pfm - 1
tmp = (4 - pfm - dom) Mod 7
If (tmp < 0) Then tmp = tmp + 7
' Easter as the number of days after 21st March */
easter = pfm + tmp + 1
If (easter < 11) Then
EasterOf = DateSerial(iYear, 3, easter + 21)
Else
EasterOf = DateSerial(iYear, 4, easter - 10)
End If
End Function
No comments have been posted about Function to compute easter day. Pass a year as integer, get a serial date.. Why not be the first to post a comment about Function to compute easter day. Pass a year as integer, get a serial date..