I'm struggling with same problem, i made something similiar to code that you posted, but it goes wrong when year changes... propably because week 1 sometimes begin in December.
Working piece of code would be highly appreciated :)
Edit: ok, now i found something, that seems to work
- function getFirstDayOfWeek($year, $weeknr)
-
{
-
$offset = date('w', mktime(0,0,0,1,1,$year));
-
$offset = ($offset < 5) ? 1-$offset : 8-$offset;
-
$monday = mktime(0,0,0,1,1+$offset,$year);
-
$date = strtotime('+' . ($weeknr - 1) . ' weeks', $monday);
-
return date('m/d/Y',$date);
-
}
This gives monday as first day of week, so you might need to do some changes if you need sunday.