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

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

WBOY
WBOYOriginal
2016-06-23 14:24:501132browse

怎么计算出开始日期到结果日期中间有哪些日期??
比如:
开始日期: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"));}

Statement:
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