GetEpact Routines
Return the Epact, which is a measure of the age of the moon (ie the number of days that have passed since an "official" new moon) on a particular date.

Unit
QESBPCSDateTime

Overloaded Variants
Function GetEpact(const Year: Word): Integer;
Function GetEpact(const Year: Integer): Integer;
Function GetEpact(const DT: TDateTime): Integer;

Declaration
Function GetEpact(const Year: Word): Integer;

Parameters
Year the Year to be processed - should be 4 digit, eg 1999.
DT the Date to be processed.

Category
Date/Time Arithmetic Routines
Year Based Arithmetic Routines

Implementation

function GetEpact (const Year: Word): Integer;
var
     Century: Integer;
begin
     Century := Year div 100 + 1;
     Result := ((11 * (GetGoldenNumber (Year) - 1)) mod 30
          + (8 * Century + 5) div 25) - (3 * Century) div 4 + 8;
     while Result < 1 do
          Result := Result + 30;
     while Result > 30 do
          Result := Result - 30;
End;

Declaration
Function GetEpact(const Year: Integer): Integer;

Implementation

function GetEpact (const Year: Integer): Integer;
var
     Century: Integer;
begin
     Century := Year div 100 + 1;
     Result := ((11 * (GetGoldenNumber (Year) - 1)) mod 30
          + (8 * Century + 5) div 25) - (3 * Century) div 4 + 8;
     while Result < 1 do
          Result := Result + 30;
     while Result > 30 do
          Result := Result - 30;
End;

Declaration
Function GetEpact(const DT: TDateTime): Integer;

Implementation

function GetEpact (const DT: TDateTime): Integer;
begin
     Result := GetEpact (Date2Year (DT));
End;


HTML generated by Time2HELP
http://www.time2help.com