Leser: 2
4 Einträge, 1 Seite |
1 2 3 4 5 6 7 8
use Date::Simple qw(date); my $d = date("2007-01-01"); $d++ until $d->day_of_week == 5; for (; $d le '2009-04-14'; $d += 7){ print $d, $/; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#!/usr/bin/perl use strict; use warnings; use Date::Calc qw( Add_Delta_Days Monday_of_Week Week_of_Year ); use Data::Dumper; my @start = (1,1,2007); my @end = (14,4,2009); my ($year,$month,$day) = Add_Delta_Days( Monday_of_Week( Week_of_Year( reverse @start ) ), 4 ); print Dumper $year,$month,$day; my @fridays; while( sprintf("%04d%02d%02d",$year,$month,$day) < sprintf("%04d%02d%02d",reverse @end) ){ push @fridays, sprintf "%02d.%02d.%04d", $day,$month,$year; ($year,$month,$day) = Add_Delta_Days( $year,$month,$day, 7 ); } print $_,"\n" for @fridays;
moritz+2008-03-14 15:54:21--Mit Date::Calc geht das sicher auch, aber halt nicht mit so schöner Syntax ;-)
4 Einträge, 1 Seite |