To make things short, here's the Delphi code of the formula developed by Carl Gauss, including the correction of Lichtenberg (the code snippet is taken from the calendar component of the SDL Component Suite):

The date is calculated for the Gregorian calendar (which is the most widely used one in the Western hemisphere). As you can easily calculate, Easter Sunday in 1953 was the 5th of April....procedure CalcEasterSunday (Year: integer; var Day, Mon: integer); (**************************************************** ENTRY: Year ....... year to be calculated EXIT: Day, Mon ... day and month of Easter Sunday ****************************************************) var kx, mk, sk : integer; ax : integer; dam : integer; rda : integer; sz : integer; og,oe : integer; begin kx := Year div 100; mk := 15 + (3*kx + 3) div 4 - (8*kx + 13) div 25; sk := 2 - (3*kx + 3) div 4; ax := Year mod 19; dam := (19*ax + mk) mod 30; rda := (dam + ax div 11) div 29; og := 21 + dam - rda; sz := 7 - (Year + Year div 4 + sk) mod 7; oe := 7 - (og - sz) mod 7; Mon := 3; Day := og + oe; if Day > 31 then begin Mon := 4; Day := Day-31; end; end;

## No comments:

## Post a Comment