2009. augusztus 16., vasárnap

Good Thursday and Easter Date function


Problem/Question/Abstract:

Here is another function that calculates the Good Thursday and any other related date for eny year. The algorithm provided here is straightforward in the sense that it calculates the Good Thursday (which is the jewish passover) as the thursday ocurring in the same week as the first spring full moon. Obviously the function can be easily adapted to calculate any full moon down to the second.

Answer:

function good_thursday(year: integer): tdatetime;
const
  full_moon: tdatetime = 34804.33889; {15/4/95 8:08}
  sunday: tdatetime = 1;
  sinodic_month: tdatetime = 29.53058912;

var
  equinoccio: tdatetime;
  lunar_months: double;
  full_moon, weeks: double;

begin
  if year < 100 then
    if year year := year + 2000
  else
    year := year + 1900;
  equinoccio := encodedate(year, 3, 21);
  lunar_months := 10000 - Int(10000 - (equinoccio - full_moon) / sinodic_month);
  full_moon := full_moon + sinodic_month * lunar_months;
  weeks := 10000 - Int(10000 - (full_moon - sunday) / 7);
  good_thursday := sunday + 7 * weeks - 3;
end;

1 megjegyzés:

  1. Calculating Easter is much easier than calculating Passover. It is true that in most years, Easter Sunday falls within the Passover week, but there are years in which there is a difference of upto a month. This is because the Jewish calendar uses a 19 year period with six different year types; some of these year types have 12 months and some 13 months. The latter types will have Easter falling outside of Passover.

    VálaszTörlés