Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to calculate Easter Day for a specified year Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
30-Aug-02
Category
Algorithm
Language
Delphi All Versions
Views
158
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

How to calculate Easter Day for a specified year

Answer:

1   function Easter(Year: Integer): TDateTime;
2   var
3     nMonth, nDay, nMoon, nEpact, nSunday, nGold, nCent, nCorx, nCorz: Integer;
4   begin
5     { The Golden Number of the year in the 19 year Metonic Cycle: }
6     nGold := (Year mod 19) + 1;
7     { Calculate the Century: }
8     nCent := (Year div 100) + 1;
9     { Number of years in which leap year was dropped in order to keep in step with 
10  the sun: }
11    nCorx := (3 * nCent) div 4 - 12;
12    { Special correction to syncronize Easter with moon's orbit: }
13    nCorz := (8 * nCent + 5) div 25 - 5;
14    { Find Sunday: }
15    nSunday := (Longint(5) * Year) div 4 - nCorx - 10; { To prevent overflow at year 
16  6554}
17    { Set Epact - specifies occurrence of full moon: }
18    nEpact := (11 * nGold + 20 + nCorz - nCorx) mod 30;
19    if nEpact < 0 then
20      nEpact := nEpact + 30;
21    if ((nEpact = 25) and (nGold > 11)) or (nEpact = 24) then
22      nEpact := nEpact + 1;
23    { Find Full Moon: }
24    nMoon := 44 - nEpact;
25    if nMoon < 21 then
26      nMoon := nMoon + 30;
27    { Advance to Sunday: }
28    nMoon := nMoon + 7 - ((nSunday + nMoon) mod 7);
29    if nMoon > 31 then
30    begin
31      nMonth := 4;
32      nDay := nMoon - 31;
33    end
34    else
35    begin
36      nMonth := 3;
37      nDay := nMoon;
38    end;
39    Easter := EncodeDate(Year, nMonth, nDay);
40  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC