Skip to content

Instantly share code, notes, and snippets.

@Tristramg
Created December 13, 2011 13:59
Show Gist options
  • Save Tristramg/1472215 to your computer and use it in GitHub Desktop.
Save Tristramg/1472215 to your computer and use it in GitHub Desktop.
function GetEasterDateByYear(pi_year : Integer) : TDateTime;
var
Y,G,C,X,Z,D,E,N,P,J,M : Integer;
begin
{Algorithme valable pour les dates comprises entre 1583 et 4099}
Y := pi_year;
G := (Y mod 19) + 1;
C := Trunc((Y/100)) + 1;
X := Trunc(3 * C / 4) - 12;
Z := Trunc(((8 * C) + 5) / 25) - 5;
D := Trunc(((5 * Y) / 4) - X - 10);
E := ((11 * G)+ 20 + Z - X) mod 30;
if ((E = 25) and (G > 11)) or (E = 24) then
E := E + 1;
N := 44 - E;
if N < 21 then
N := N + 30;
P := N + 7 - ((D + N) mod 7);
if P > 31 then
J := P - 31
else
J := P;
if J = P then
M := 3
else
M := 4;
Result := EncodeDate(pi_year, M, J);
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment