THE BEEHIVE OBSERVATORY

DATE OF EASTER FORMULAE
November 2021

 Home Page 

Well, it can be useful to know when easter will be, especially if you're planning a holiday to go to dark skies.
First I'll present a PowerShell script of mine that I made using the National Maritime Museum's algorithm based on Carter's algorithm, it says. It is supposed to be accurate for dates 1900-2099. Further down is a C# program that should work for all dates.


# FILE: EasterCalc.ps1
# INFO: Western church date of easter sunday, years 1900 to 2099.
# Derived from the National Maritime Museum's publication of Carter's
# algorithm.
# COPYRIGHT: M.Felton, 2018
# ENVIRONS: Windows, PowerShell.
# TESTED: Win 8.1
# REFERENCE: https://www.rmg.co.uk/discover/explore/when-easter
Function CalculateEasterDay($YYYY)
{
$rem = 0
$E = 0
[math]::DivRem($YYYY, 19, [ref]$rem) | Out-Null
$D = 225 - (11 * $rem)

if ($D -gt 50)
{
for (; $D -ge 51;) {$D -= 30}
}
if ($D -gt 48) {$D -= 1}

$yo4 = [math]::Floor($YYYY / 4)
$ee = [int]($YYYY + $yo4) + $D + 1
[math]::DivRem(($ee), 7, [ref]$E) | Out-Null
$Q = $D + 7 - $E

if ($Q -lt 32)
{
$M = 3
$D = $Q
}
else
{
$M = 4
$D = $Q - 31
}
return -join($D,"/",$M,"/",$YYYY)
}

# Events
$btCalculate_Click =
{
$Easter.Text = CalculateEasterDay([int]($txYear.Text))
}

# Declarations
Add-Type -AssemblyName System.Windows.Forms

# Process
$Form = New-Object system.Windows.Forms.Form
$Form.Text = "Date of Easter"
$Form.AutoSizeMode = "GrowAndShrink"
$Form.BackColor = "0xffeeee"

$Label = New-Object System.Windows.Forms.Label
$Label.Text = "Year (yyyy)"
$Label.AutoSize = $False
$Label.Width = 100

$txYear = New-Object System.Windows.Forms.TextBox
$txYear.AutoSize = $True
$txYear.Left = 80

$btCalculate = New-Object System.Windows.Forms.Button
$btCalculate.Text = "Calculate"
$btCalculate.AutoSize = $True
$btCalculate.Left = $txYear.Right + 20
$btCalculate.Enabled = $True
$btCalculate.Add_Click($btCalculate_Click)

$Easter = New-Object System.Windows.Forms.Label
$Easter.AutoSize = $False
$Easter.Width = 100
$Easter.Top = 100
$global:Form.Controls.Add($Easter)

$Form.Controls.Add($txYear)
$Form.Controls.Add($Label)
$Form.Controls.Add($btCalculate)
$Form.ShowDialog()




Here is Simon Kershaw's algorithm that I just packaged up into C#. It is precise, always, unless I made a mistake.




/* Simple EASTER date programme *
* ============================ *
* Read the year from the command line (no error checking!) *
* and write the date of Easter, according to the Gregorian *
* calendar (for years after 1752) or the Julian Calendar *
* (for years before 1753), to standard output *
* 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, . *
* All rights reserved. *
*/

/*
* Adapted by Miles Felton, 2007.
*/

/*
* 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. *
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.VisualBasic;


namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{

}
private void button1_Click(object sender, EventArgs e)
{
int year, golden, solar, lunar, pfm, dom, tmp, easter;
year = Convert.ToInt16(textBox1.Text);
/* the Golden number */
golden = (year % 19) + 1;

if ( year <= 1752 )
{
/* JULIAN CALENDAR */
/* the "Dominical number" - finding a Sunday */
dom = (year + (year/4) + 5) % 7;
if (dom < 0) dom += 7;

/* uncorrected date of the Paschal full moon */
pfm = (3 - (11*golden) - 7) % 30;
if (pfm < 0) pfm += 30;
}
else
{
/* GREGORIAN CALENDAR */
/* the "Dominical number" - finding a Sunday */
dom = (year + (year/4) - (year/100) + (year/400)) % 7;
if (dom < 0) dom += 7;

/* the solar and lunar corrections */
solar = (year-1600)/100 - (year-1600)/400;
lunar = (((year-1400) / 100) * 8) / 25;

/* uncorrected date of the Paschal full moon */
pfm = (3 - (11*golden) + solar - lunar) % 30;
if (pfm < 0) pfm += 30;
}

/* corrected date of the Paschal full moon - days after 21st March */
if ((pfm == 29) || (pfm == 28 && golden > 11))
pfm--;

tmp = (4-pfm-dom) % 7;
if (tmp < 0) tmp += 7;

/* Easter as the number of days after 21st March */
easter = pfm + tmp + 1;

if (easter < 11)
{
easter += 21;
textBox2.Text = "Sunday, " + easter.ToString() + " March " + textBox1.Text;
}
else
{
easter -= 10;
textBox2.Text = "Sunday, " + easter.ToString() + " April " + textBox1.Text;
}
}

}
}

 Home Page