PHP获取指定日期的月份月初日期和月末日期
// 获取指定日期的月初与月末日期
protected function GetTheMonth($date){
$firstday = date("Y-m-01",strtotime($date)); //月初
$lastday = date("Y-m-d",strtotime("$firstday +1 month -1 day")); //月末
$last_month_firstday = date("Y-m-01",strtotime("$date -1 month ")); //上月初
$last_month_lastday = date("Y-m-d",strtotime("$last_month_firstday +1 month -1 day")); //上月末
return array('firstday'=>$firstday,'lastday'=>$lastday,'last_month_firstday'=>$last_month_firstday,'last_month_lastday'=>$last_month_lastday);
}
来源:CSDN
作者:衣裙飞舞
链接:https://blog.csdn.net/xzmj_/article/details/103970872