PHP 获取本月及上个月第一天和最后一天
//本月
$calcStartMonth = strtotime(date('Y-m')); //第一天
$calcEndMonth = strtotime(date('Y-m-t 23:59:59', $calcStartMonth)); //最后一天
//上个月
$calcStartMonth = strtotime(date('Y-m-01', strtotime('last month'))); //上个月第一天
$calcEndMonth = strtotime(date('Y-m-t 23:59:59', strtotime('last month'))); //上个月最后一天的最后一秒
//$calcEndMonth = strtotime(date('Y-m-t', strtotime('last month'))); //上个月最后一天
posted @
2024-05-24 15:49
贱贱丶
阅读(1223)
评论(0)
收藏
举报