美文网首页
PHP获取指定时间的前6个月

PHP获取指定时间的前6个月

作者: Mr丶林 | 来源:发表于2017-11-08 17:19 被阅读0次
//        获取指定日期的前六个月
        function to_sex_month(){
            $today = input('param.today') ? input('param.today') : date("Y-m-d");
            $arr = array();
            $old_time = strtotime('-5 month',strtotime($today));
            for($i = 0;$i <= 6; ++$i){
                $t = strtotime("+$i month",$old_time);
                $arr[] = explode('/',date('Y-m-01',$t).'/'.date('Y-m-',$t).date('t',$t));
            }
            return $arr;
        }

相关文章

网友评论

      本文标题:PHP获取指定时间的前6个月

      本文链接:https://www.haomeiwen.com/subject/umyymxtx.html