1. 程式人生 > >php獲取某年每週的週六日期

php獲取某年每週的週六日期

程式碼片段:

$first_Sat=date('Y-m-d',strtotime('this Saturday',strtotime("2015-01-01")));
$Sat=array($first_Sat);
for($i=0;;$i+=7){
    $current_time=strtotime($i.' days',strtotime($first_Sat));
    if($current_time>strtotime('2015-12-31')){
        break;
    }
    $Sat[]=date('Y-m-d',$current_time);
}
var_