In PHP, is there an easy way to get the first and last date of a month?

后端 未结 11 969
无人及你
无人及你 2020-12-01 11:47

I need to get the first and last day of a month in the format YYYY-MM-DD given only the month and year. Is there a good, easy way to do this?

11条回答
  •  北荒
    北荒 (楼主)
    2020-12-01 12:29

    ";
    $num = cal_days_in_month(CAL_GREGORIAN, date("m"), date("Y"));
    echo "Monthe End - " . $monthEnd = date("Y-m-".$num);
    ?>
    

提交回复
热议问题