print weeksToDays ( 1, 2013) ; (1st week of 2013)
####
31/12/2012 to 8/1/2012 (it should be ...to 6/1/2013)
####
print weeksToDays ( 2, 2013) ; (2nd week of 2013)
####
7/1/2013 to 13/1/2013
####
use Date::Calc qw ( Monday_of_Week Add_Delta_Days );
sub weekToDays {
$week = shift;
$year = shift;
($year,$month,$day) = Monday_of_Week($week,$year);
($y, $m, $d) = Add_Delta_Days( Monday_of_Week( $week, $year ), 6);
return "$day/$month/$year to $d/$m/$y";
}
print "First week of 2013: ".weekToDays ( 1, 2013) ."\n" ;
print "Second week of 2013: ".weekToDays ( 2, 2013) ."\n" ;