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

//        获取指定日期的前六个月
        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;
        }

猜你喜欢

转载自www.cnblogs.com/houdj/p/11211181.html