Visit our Sponsor   Visit our Sponsor
delphi3000.com - the free delphi knowledge platform
delphi3000.com - the free delphi knowledge platform
484 Users Online NOW
Have a look at your member-status

connecting people's knowledge


  - Recent ArticlesRSS feed for Recent Articles on delphi3000.com
  - List of All Articles
  - Top Viewed Articles
  - Articles (+Attachem.)
  - Articles Of Interest
  - Categories
  - Top Uploader
  - Search
  - Index

  - My Home
  - Submit an Article
  - My Articles
  - My Personal Data
  - My Bookmarks
  - Activities
  - Login/Logout

  - Sign Up
  - Why Sign Up
  - Newsletter

  - Press
  - Advertise

  - Contact
  - Feedback





Community
Borland
ClubeDelphi
Dr. Bob
UK-BUG
Delphi Meetings
Planeta Delphi



Loremo - the 1.5 liter car coming in 2009




Startblatt.de






Share this article with friendsShare this article with friends
Rate this articleRate this article - to keep the quality of delphi3000.com !
Comment this article or read through previous comments (0)


Happy Easter :)Format this article printer-friendly!Bookmark function is only available for registered users!
Product:
Delphi 3.x (or higher)
Category:
Algorithm
Skill Level:
Scoring:
Last Update:
06/15/2002
Search Keys:
delphi delphi3000 article borland vcl code-snippet easter ostern holiday bunny
Times Scored:
1
Visits:
2096
Uploader: Oliver Moenche
Company:
Reference: N/A
 
Question/Problem/Abstract:
This program demonstrates how to determine the easter date for a given year.
Answer:



It's quite complex:


function GetEaster(Year: Integer): TDate;
var
  y, m, d: Word;
  G, I, J, C, H, L: Integer;
  E: TDate;
begin
  G := Year mod 19;
  C := year div 100;
  H := (C - C div 4 - (8*C+13) div 25 + 19*G + 15) mod 30;
  I := H - (H div 28)*(1 - (H div 28)*(29 div (H + 1))*((21 - G) div 11));
  J := (Year + Year div 4 + I + 2 - C + C div 4) mod 7;
  L := I - J;
  m := 3 + (L + 40) div 44;
  d := L + 28 - 31*(m div 4);
  y := Year;
  // E is the date of the full moon
  E := EncodeDate(y, m, d);
  // find next sunday
  while DayOfWeek(E) > 1 do
    E := E + 1;
  Result := E;
end;

{
Usage
var EasterDate: TDateTime;
...
EasterDate := GetEaster(2002);
}


//* it may work under Delphi v1.x and v2.x as well. i tested it with Delphi 6 Enterprise and it worked fine. *//





Please rate this article!
Skill level:
BeginnerExpert

Useful:
No!Very!

Overall rating:
PoorExcellent



Comments to this article
Write a new comment













 
Sign up to consume product discounts for Bronze memberships !

read more


  Visit our Sponsor

 

  Community Ad of
D. Souchard
 
   














 







     
  Copyright © 2000 - 2007 delphi3000.com - All rights reserved. Terms of use. || Privacy
delphi3000.com is a service by bluestep.com IT-Services GmbH (Vienna)