Home > Backend Development > PHP Tutorial > 求两个时间点之间有哪些天,比如2013.03.29?2013.04.01之间有20130330,20130331两天

求两个时间点之间有哪些天,比如2013.03.29?2013.04.01之间有20130330,20130331两天

WBOY
Release: 2016-06-23 14:04:10
Original
745 people have browsed it

php求两个时间点之间有哪些天,比如2013.03.29?2013.04.01之间有20130330,20130331两天 。

用户选两个时间点,我就要把他选的数据做成报表导出来。
因为有些数据在有些天里是没有值的,所以,根据所选时间来遍历,把有的值插入,没有的值归0,所以有这个需求,谢谢帮忙!


回复讨论(解决方案)

百度上的正确答案
$j=0;
for($i = strtotime('2010-01-01'); $i  '); $i += 86400) {
       
        $y=mktime(0,0,0,01,01,2010);
  $t=date("Y-m-d",$y+$j*24*3600);
  print $t.'
';
  $j++;
}

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