zoukankan      html  css  js  c++  java
  • php 计算 时间段的天数

                $firstday = date("Y-m-d H:i:s",time());//当前日期
                $timestamp=strtotime($firstday);//当前日期时间戳
                $firstday=date('Y-m-01',strtotime(date('Y',$timestamp).'-'.(date('m',$timestamp)-1).'-01'));//上个月开始的日期
                $lastday=date('Y-m-d',strtotime("$firstday +1 month -1 day"));//上个月结束的日期
                $stimestamp = strtotime($firstday);
                $etimestamp = strtotime($lastday);
                // 计算日期段内有多少天
                $days = ($etimestamp-$stimestamp)/86400+1;
                // 保存每天日期
                $date = array();
                for($i=0; $i<$days; $i++){
                    $date[] = date('Y-m-d', $stimestamp+(86400*$i));
                }

  • 相关阅读:
    【Lua】LuaForWindows_v5.1.4-46安装失败解决方案
    【C++】指针引发的bug
    【C++】指针引发的bug
    【C++】位操作(3)-获取某位的值
    bzoj1444
    bzoj1758
    bzoj3091
    poj1741 bzoj2152
    bzoj2125 3047
    bzoj3669
  • 原文地址:https://www.cnblogs.com/xiaoqiangjun/p/11041315.html
Copyright © 2011-2022 走看看