Dato for første dag på en vilkårlig uge
I forlængelse af: http://www.eksperten.dk/spm/785029Følgende kode virker fint hvis f.eks
week = 26
year = 2007 men hvis man bruger flg:
http://ajh.phpnet.us/test2.php?w=53&y=2006
week 53 år 2006 så stener dato'erne ret meget :-)
Mvh
Anders
KODE:
<?php
/* WEEK & YEAR SELECTION */
if(isset($_GET["w"]) == false || isset($_GET["y"]) == false) {
$week = date(W);
$year = date(Y);
}
else {
$week = $_GET["w"];
$year = $_GET["y"];
}
if($week > 53){$week = date(W);};
if($year < 0){$week = date(Y);};
echo ($week." ".$year."<br><br>");
$dage = array('Mon','Tue','wed','Thu','Fri','Sat','Sun');
$week = $week -1;
while($a < count($dage)) {
$timestamp_year = mktime(0,0,0,1,1,$year);
echo date("d/m",strtotime("+$week week $dage[$a]",$timestamp_year)) . "<br>";
$a++;
}
?>