in reply to week days in a given date range
Since I'm in such a good mood, I give you a solution using Date::Manip, the coolest date module.
Output:perl -we 'use Date::Manip; use Data::Dumper; my ($date, $end) = @ARGV; + my %out; while (Date_Cmp($date, $end) <= 0) { push @{$out{UnixDate($ +date, "%A")}}, UnixDate($date, "%b %e, %Y"); $date = DateCalc($date, +"+1 day"); } print Dumper \%out;' 'Oct 01, 2005' 'Oct 16, 2005'
$VAR1 = { 'Tuesday' => [ 'Oct 4, 2005', 'Oct 11, 2005' ], 'Saturday' => [ 'Oct 1, 2005', 'Oct 8, 2005', 'Oct 15, 2005' ], 'Sunday' => [ 'Oct 2, 2005', 'Oct 9, 2005', 'Oct 16, 2005' ], 'Wednesday' => [ 'Oct 5, 2005', 'Oct 12, 2005' ], 'Friday' => [ 'Oct 7, 2005', 'Oct 14, 2005' ], 'Thursday' => [ 'Oct 6, 2005', 'Oct 13, 2005' ], 'Monday' => [ 'Oct 3, 2005', 'Oct 10, 2005' ] };
|
|---|