Return to Snippet

Revision: 24220
at February 23, 2010 17:51 by jkjeldgaard


Initial Code
public function getDaysInWeek($week, $year) {
        $week = sprintf('%02d',$week); //format as a 2 digit number. eg: 05

        // set up ISO week date, eg: 2006W527, sunday(7), week 52 of 2006
        $daysInWeek = array();
        for ($day = 1;
        $day <= 7;
        $day++) {
            $ISOweekDate = $year . "W" . $week . $day;
            $daysInWeek[] = strtotime($ISOweekDate);
        }

        return $daysInWeek;
    }

Initial URL

                                

Initial Description
/**
     * @param Int $week
     * @param Int $year
     * @return Array
     */

Initial Title
get dates by week and year

Initial Tags
php, date

Initial Language
PHP