1

If the clock is not complicated enough, with DST and timezones.... holidays and red days is even more complicated..... (a perl sub which returns all red days for sweden. It does not return any holidays thats always saturday or sunday)
Requires Date::Calc and Date::Easter

What a mess dates and times become..,

sub GetHoliDayList() {

$yeartocheck = $_[0];

$holiday{'1-1'} = '1';
$holiday{'1-6'} = '1';
$holiday{'5-1'} = '1';
$holiday{'6-6'} = '1';
$holiday{'6-24'} = '1';
$holiday{'12-24'} = '1';
$holiday{'12-25'} = '1';
$holiday{'12-26'} = '1';
$holiday{'12-31'} = '1';

($eastermonth, $easterday) = gregorian_easter( $yeartocheck );
$hea = int($eastermonth)."-".int(int($easterday) - 2);
$heb = int($eastermonth)."-".int(int($easterday) + 1);
$holiday{$hea} = '1';
$holiday{$heb} = '1';

($year,$christskytravellermonth,$christskytravellerday) = Add_Delta_YMD($yeartocheck,$eastermonth,$easterday, 0,0,39);
$chstv = int($christskytravellermonth)."-".int($christskytravellerday);
$holiday{$chstv} = '1';

if (Day_Of_Week($yeartocheck,6,19) == 5) {
$holiday{'6-19'} = '1';
}
if (Day_Of_Week($yeartocheck,6,20) == 5) {
$holiday{'6-20'} = '1';
}
if (Day_Of_Week($yeartocheck,6,21) == 5) {
$holiday{'6-21'} = '1';
}
if (Day_Of_Week($yeartocheck,6,22) == 5) {
$holiday{'6-22'} = '1';
}
if (Day_Of_Week($yeartocheck,6,23) == 5) {
$holiday{'6-23'} = '1';
}
if (Day_Of_Week($yeartocheck,6,24) == 5) {
$holiday{'6-24'} = '1';
}
if (Day_Of_Week($yeartocheck,6,25) == 5) {
$holiday{'6-25'} = '1';
}

return %holiday;
}

Comments
Add Comment