1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
{---------------------------- Retourne La date de Paques ----------------------}
function Paques( _Year: word = 0 ): TDateTime;
// http://www.tondering.dk/claus/calendar.html
var a, b, c, d, e, mois, jour: integer;
begin
if _Year = 0 then _Year := YearOf( Date );
a := _Year mod 19;
b := _Year div 100;
c := (b - (b div 4) - ((8 * b + 13) div 25) + (19 * a) + 15) mod 30;
d := c - (c div 28) * (1 - (c div 28) * (29 div (c + 1)) * ((21 - a) div 11));
e := d - ((_Year + (_Year div 4) + d + 2 - b + (b div 4)) mod 7);
mois := 3 + ((e + 40) div 44);
jour := e + 28 - (31 * (mois div 4));
Result := EncodeDate( _Year, mois, jour );
end;
{------------------------ Lundi de paques -------------------------------------}
function PaquesLundi( _Year: word = 0 ): TDateTime;
begin
Result := Paques( _Year ) + 1;
end;
{------------------------ Renvoi La date De Ascenssion ------------------------}
function Ascension( _Year: word = 0 ): TDateTime;
begin
Result := Paques( _Year ) + 39;
end;
{------------------------ Renvoi Pentecote ------------------------------------}
function Pentecote( _Year: word = 0 ): TDateTime;
begin
Result := Paques( _Year ) + 49;
end;
{--------------------------- Renvoi Lundi de Pentecote ------------------------}
function PentecoteLundi( _Year: word = 0 ): TDateTime;
begin
Result := Paques( _Year ) + 50;
end;
{------------------------------ Liste des jours feriés ---------------------------}
Procedure List_jour_feries(_Year : Word; Var List_jf : TStringList; var List_jfd : TStringList);
begin
List_jf.Clear;
List_jfd.Clear;
// jour de l'an
if _Year = 0 then _Year:= YearOf(Date);
List_jf.Add( floattostr( EncodeDate( _Year , 1 , 1 ) ) );
List_jfd.add('Jour de l''an');
// 1er mai (fête du Travail)
List_jf.Add( floattostr( EncodeDate( _Year , 5 , 1 ) ) );
List_jfd.add('Fête du travail');
// 15 août (Assomption)
List_jf.Add( floattostr( EncodeDate( _Year , 8 , 15 ) ) );
List_jfd.add('Assomption');
// 1er novembre (Toussaint)
List_jf.Add( floattostr( EncodeDate( _Year , 11 , 1 ) ) );
List_jfd.add('Toussaint');
// 25 décembre (Noël)
List_jf.Add( floattostr( EncodeDate( _Year , 12 , 25 ) ) );
List_jfd.add('Noël');
(****************************** Fêtes mobiles *********************************)
// Pâques
List_jf.Add( floattostr( Paques( _Year ) ) );
List_jfd.add('Pâques');
// Lundi de Pâques (lundi après Pâques)
List_jf.Add( floattostr( PaquesLundi( _Year ) ) );
List_jfd.add('Lundi de pâques');
// Ascension (6e jeudi (39j) après Pâques)
List_jf.Add( floattostr( Ascension( _Year ) ) );
List_jfd.add('Ascension');
// Pentecôte (7e dimanche (49j) après Pâques)
List_jf.Add( floattostr( Pentecote( _Year ) ) );
List_jfd.add('Pentecôte');
// Lundi de la Pentecôte (lundi après la Pentecôte)
List_jf.Add( floattostr( PentecoteLundi( _Year ) ) );
List_jfd.add('Lundi de Pentecôte');
end; |
Partager