php 获取当前月份的开始结束日期

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 获取当前月份的开始结束日期相关的知识,希望对你有一定的参考价值。


    public static function getCurrentMonth()
    {
        //当前月份
        $sdefaultDate = date("Y-m");
        $month_start = strtotime($sdefaultDate);
        $nextMonth = strtotime('+1 month',$month_start);
        $month_end = $nextMonth - 1;
        return [
            'start' => $month_start,
            'end' => $month_end
        ];
    }

以上是关于php 获取当前月份的开始结束日期的主要内容,如果未能解决你的问题,请参考以下文章