Thread Zinstage (13 answers)
Opened by bianca at 2012-08-30 08:17

AndiE
 2012-08-30 16:55
#161494 #161494
User since
2010-10-24
65 Artikel
BenutzerIn
[default_avatar]
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
sub zinstage {
    my ($callback) = @_;
    my @von = split /\./,$callback->{von};
    my @bis = split /\./,$callback->{bis};
    $von[0] = 30 if $von[0] > 30;       
    $bis[0] = 30 if $bis[0] > 30;
    $callback->{tage} = 30 - $von[0] + $bis[0];
# Februarregelung
    if($von[1]==2) {
        if($von[2]%4==0){
                $callback->{tage} -=1;
        }
        else {
                $callback->{tage} -=2;
        }       
    }
    if ($von[1] + 1 != $bis[1]) {
        $callback->{tage} += ($bis[1] - $von[1] - 1) * 30;
    }
    if ($bis[2] > $von[2]) {
        $callback->{tage} += ($bis[2] - $von[2]) * 360;
    }
}


Das wäre meine Idee zum Umgang mit dem Februar

View full thread Zinstage