I want to have the timestamps of week numbers, this is working perfectly from the year 2011 to 2012. It refuses to switch to the year 2013.
Do anyone know what i'm doing wrong?:
<?php
$year='2012';
$weekno='01';
$date = strtotime($year.'W'.$weekno);
for($i=0;$i<55;$i++){
print date('d-m-Y W',$date)."\n";
$date=(weekno($date,'1'))."\n";
$date=(int)$date;
}
function weekno($date,$step=''){
$year=date('Y',$date);
$weekno=date('W',$date);
$date = strtotime($year.'W'.$weekno);
if($step>0){
$date = strtotime($year.'W'.$weekno. '+1 week');
}
if($step<0){
$date = strtotime($year.'W'.$weekno. '-1 week');
}
return($date);
}
?>