<?php
function getthemonth($date)
{
$firstday = date('Y-m-01', strtotime($date));
$nowday = date('Y-m-d', strtotime($date));
$lastday = date('Y-m-d', strtotime("$firstday +1 month -1 day"));
return array($firstday,$nowday,$lastday);
}
$today = date("Y-m-d");
$day=getthemonth($today);
echo "当月的第一天: ".$day[0]." 当天日期: ".$day[1]." 当月的最后一天: ".$day[2];
echo "<br/>";
if($day[0] == $day[1]){
echo '今天的日期是当月的第一天';
}else{
$num = explode('-',$day[1]);
echo '今天的日期不是当月的第一天,而是第'.$num[2].'天';
}
?>
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!