Home > Backend Development > PHP Tutorial > 怎么计算出开始日期到结果日期中间有哪些日期

怎么计算出开始日期到结果日期中间有哪些日期

WBOY
Release: 2016-06-23 14:24:50
Original
1173 people have browsed it

怎么计算出开始日期到结果日期中间有哪些日期??
比如:
开始日期:2013-10-28
结束日期:2013-11-02
包含的日期就有:2013-10-28,2013-10-29,2013-10-30,2013-10-31,2013-11-01,2013-11-02

开始日期:2013-12-29
结束日期:2014-01-02
包含的日期就有:2013-12-29,2013-12-30,2013-12-31,2014-01-01,2014-01-02


回复讨论(解决方案)

使用 mktime 函数不停的加 

$start='2013-10-28';$end='2013-11-02';while($start<=$end){     echo $start.'<br>';	 $start=date("Y-m-d",strtotime("$start +1 day"));}
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