Easter can only calculated from year 1 on. Before that easter is not defined.

Now tell for which calendar: Julian or Gregorian?

For the rest have a look at the Jedi Code Library. One of several ways to calculate easter sunday.

Solved

Posted on 2002-04-01

hi experts,

i am starting a new quest: qow = question of the week :-)

each week i will introduce a new simple? question.

now qow 13

(missed last later, thats why twice this week)

the first working solution will get the points (a graded).

sorry, top 15 experts, you are not allowed to solve this

q, only other can solve this question :-(

well the question is:

how to calculate easter-days for any year?

a little sample is needed

let see

meikl ;-)

i am starting a new quest: qow = question of the week :-)

each week i will introduce a new simple? question.

now qow 13

(missed last later, thats why twice this week)

the first working solution will get the points (a graded).

sorry, top 15 experts, you are not allowed to solve this

q, only other can solve this question :-(

well the question is:

how to calculate easter-days for any year?

a little sample is needed

let see

meikl ;-)

4 Comments

Easter can only calculated from year 1 on. Before that easter is not defined.

Now tell for which calendar: Julian or Gregorian?

For the rest have a look at the Jedi Code Library. One of several ways to calculate easter sunday.

See http://www.smart.net/~mmontes/ec-cal.html for an explanation of the algorithm and restrictions.

http://www.delphiforfun.com/Programs/easter.htm

- source extract -

unit U_Easter;

{Calculates the date of Easter given any year. I don't pretend to understand

the details of the algorithm. It comes from the Art Of Programming series

of books by Donald Knuth}

{Gary Darby, www.dephiforfun.org}

interface

{..... generated code snipped ....}

implementation

Function KnuthCalcEaster(year:integ

{From Vol 3 of The Art of Computer Programming, Donlad E. Knuth}

var

golden,century:integer;

Correction1,Correction2:in

Sunday,Epact:Integer;

N:Integer;

begin

If Year <= 1582 then

Showmessage('OK, but results are only valid for years after 1582');

Golden := Year mod 19 + 1 ;

Century := Year div 100 + 1 ;

Correction1 := trunc(3.0 * Century / 4.0) - 12;

Correction2 := trunc((8.0 * Century + 5.0) / 25.0) - 5;

Sunday := trunc(5.0 * year / 4.0) - Correction1 -10 ;

Epact := (11 * Golden + 20 + Correction2 - Correction1) mod 30 ;

IF ((Epact = 25) and (Golden > 11)) or (Epact = 24) then

Epact := Epact + 1 ;

N := 44 - Epact;

if N < 21 then N := N + 30 ;

N := N + 7 - ((Sunday + N) mod 7) ;

try

{Pass a Year, Month, and Day and get a date back}

easter:=encodedate(year,3,

result:=FormatDateTime('mm

except

showmessage(inttostr(year)

result:='';

easter:=0;

end;

end;

Procedure TForm1.getdate(Year:intege

{take a year, calculate Easter date and display it}

var

iswas:string;

s:string;

Easter:TDateTime;

begin

s:=Knuthcalceaster(year,Ea

If easter>now then iswas:=' will be on '

else iswas:=' was on ';

Easter2lbl.Caption:='Easte

+ iswas +s;

Intedit1.text:=inttostr(ye

end;

procedure TForm1.IntEdit1KeyPress(Se

{Get integers and show Easter when Enter key is pressed}

begin

If key=#13 then

begin

Getdate(strtoint(IntEdit1.

key:=#00;

end

else if not (key in ['0'..'9']) then

begin beep; key:=#00; end;

end;

procedure TForm1.FormActivate(Sender

var

y,m,d:word;

m2,d2:integer;

e1,e2:TDateTime;

s1,s2:string;

begin

{set current data at start up time}

decodedate(now,y,m,d);

getdate(y);

end;

procedure TForm1.IntEdit1Click(Sende

begin {also show Easter if year is clicked}

getdate(strtoint(intedit1.

end;

end.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Title | # Comments | Views | Activity |
---|---|---|---|

IdTelnet1DataAvailable handler freezes the Application | 4 | 62 | |

Copy file in dll not working but working on exe ! | 18 | 87 | |

Delphi selector screen | 2 | 69 | |

Can Viruses spread while transferring files via FTP protocol to unshared NAS drives ? | 6 | 83 |

Join the community of 500,000 technology professionals and ask your questions.

Connect with top rated Experts

**16** Experts available now in Live!