Home > Backend Development > PHP Tutorial > PHP获取某一年所有的周六日期

PHP获取某一年所有的周六日期

WBOY
Release: 2016-06-23 13:33:46
Original
1431 people have browsed it

直接贴代码:

<?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_dump($Sat);
Copy after login

代码书写格式,以及效率方面,自己去优化

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template