unit U_Feiertage;
interface
uses Windows, SysUtils;
type
THoliday =
Record
Date: TDateTime;
Name:
String;
End;
THolidayTable =
Array Of THoliday;
Function GetHolidayTable(Year: Word): THolidayTable;
implementation
Function GetHolidayTable(Year: Word): THolidayTable;
Procedure AddHoliday(DD, MM: Word; HDName:
String);
Overload;
Begin
SetLength(Result, High(Result) + 2);
With Result[High(Result)]
Do
Begin
Date := EncodeDate(Year, MM, DD);
Name := HDName;
End;
End;
Procedure AddHoliday(HDDate: TDateTime; HDName:
String);
Overload;
Begin
SetLength(Result, High(Result) + 2);
With Result[High(Result)]
Do
Begin
Date := HDDate;
Name := HDName;
End;
End;
Function GetEasterDate(YYYY: Word): TDateTime;
Var
A, B, C, D, E, F, G, H, I, K, L, M, N, P: Word;
DD, MM: Word;
Begin
a := YYYY
Mod 19;
b := YYYY
Div 100;
c := YYYY
Mod 100;
d := b
Div 4;
e := b
Mod 4;
f := (b + 8)
Div 25;
g := (b - f + 1)
Div 3;
h := (19 * a + b - d - g + 15)
Mod 30;
i := c
Div 4;
k := c
Mod 4;
l := (32 + 2 * e + 2 * i - h - k)
Mod 7;
m := (a + 11 * h + 22 * l)
Div 451;
n := (h + l - 7 * m + 114)
Div 31;
p := (h + l - 7 * m + 114)
Mod 31 + 1;
DD := p;
MM := n;
Result := EncodeDate(YYYY, MM, DD);
End;
Var
EDate: TDateTime;
Begin
AddHoliday(1, 1, '
Neujahr');
AddHoliday(6, 1, '
Heiligen Drei Könige');
AddHoliday(1, 5, '
Tag der Arbeit');
AddHoliday(3, 10, '
Tag der deutschen Einheit');
AddHoliday(31, 10, '
Reformationstag');
AddHoliday(25, 12, '
1. Weihnachtsfeiertag');
AddHoliday(26, 12, '
2. Weihnachtsfeiertag');
EDate := GetEasterDate(Year);
AddHoliday(EDate, '
Ostersonntag');
AddHoliday(EDate - 2, '
Karfreitag');
AddHoliday(EDate + 1, '
Ostermontag');
AddHoliday(EDate + 39, '
Christi Himmelfahrt');
AddHoliday(EDate + 49, '
Pfingstsonntag');
AddHoliday(EDate + 50, '
Pfingstmontag');
//Ermittelt den 3. Mitwoch im November ...
EDate := EncodeDate(Year, 11, 1);
EDate := EDate + ((11 - DayOfWeek(EDate))
Mod 7) + 14;
AddHoliday(EDate, '
Buß- und Bettag');
End;
end.