首页 > Web开发 > 详细

php 计算时间戳之间的时间

时间:2020-09-02 11:33:13      阅读:52      评论:0      收藏:0      [点我收藏+]

 

    /**
     * 计算时间戳之间的时间,返回时间数组
     * $start 开始时间戳
     * $end 结束时间戳
     * $step 增长时间步长,默认一天
     */
    public function getTime($start, $end , $step = 86400, $format = false) {
        $time = [];
        do {
            if($format == true){
                $time[] =  date(‘Y-m-d H:i:s‘,strval($start));
            }else{
                $time[] =  strval($start);
            }
        } while (($start += $step) <= $end);    // 重复 Timestamp + $step, 直至大于结束日期中止
        return $time;
    }

 

php 计算时间戳之间的时间

原文:https://www.cnblogs.com/-mrl/p/13600475.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!