//获取到的时间字符串
$date = I('time');
$firstday = date('Y-m-01', strtotime($date));
$lastday = date('Y-m-d', strtotime("$firstday +1 month -1 day"));
//转换成时间戳
$firstday = strtotime($firstday);
$lastday = strtotime($lastday);
//获取到的时间字符串
$date = I('time');
$firstday = date('Y-m-01', strtotime($date));
$lastday = date('Y-m-d', strtotime("$firstday +1 month -1 day"));
//转换成时间戳
$firstday = strtotime($firstday);
$lastday = strtotime($lastday);
本文标题:PHP获取当月第一天和最后一天
本文链接:https://www.haomeiwen.com/subject/onzvkxtx.html
网友评论