Hab das ganze jetzt so realisiert (noch ohne Abzug von Feiertagen/Urlaub):
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
#!/usr/bin/perl -w
use strict;
use Date::Handler;
my $start_year = 2004;
my $start_month = 9;
my $start_day = 1;
my $end_year = 2006;
my $end_month = 9;
my $end_day = 1;
my $date;
my ($week_day, $year, $month, $day, $max_month, $max_day, $min_month);
my @work_days = ();
for $year ($start_year .. $end_year){
if ( ($year eq $start_year) ){
$min_month = $start_month;
} else {
$min_month = 1;
}
if ( ($year eq $end_year) ){
$max_month = $end_month;
} else {
$max_month = 12;
}
for $month ($min_month .. $max_month){
$date = new Date::Handler({ date => { year => $year, month => $month, day => 0 },});
if ( ($year eq $end_year) && ($month eq $end_month) ){
$max_day = $end_day;
} else {
$max_day = $date->DaysInMonth();
}
for $day ($start_day .. $max_day){
$date = new Date::Handler({ date => { year => $start_year, month => $month, day => $day },});
$week_day = $date->WeekDayName();
push(@work_days, $week_day.';;'.$day.';;'.$month.';;'.$year) unless ( ($week_day eq 'Saturday') || ($week_day eq 'Sunday') );
}
}
}
my @dump= ();
foreach my $work_day (@work_days) {
@dump = split(';;', $work_day);
print "$dump[0]\t$dump[1].$dump[2].$dump[3]\n";
}
funzt!