标签:
//PHP获取指定月份的月初月尾时间
//获取上月月初月尾时间:
$startday=strtotime(date("Y-m-d H:i:s",mktime(0,0,0,date("m")-1,1,date("Y"))));
//获取上月头时间endday = strtotime(date(“Y-m-d H:i:s”,mktime(23,59,59,date(“m”) ,0,date(“Y”)))); //获取上月尾时间
echo $startday;
echo "<br>";
//获取指定月份月初月尾时间:
$yourdate=strtotime(date("Y-m-01 00:00:00"));
$endday = strtotime(date(‘Y-m-d‘, mktime(23, 59, 59, date(‘m‘, strtotime($yourdate))+1, 00)));
echo $yourdate;
echo "<br>";
echo $endday;
echo "<br>";
//获取本月月初月尾时间:
echo date("Y-m-d H:i:s",mktime(0, 0 , 0,date("m"),1,date("Y")));
echo "<br>";
echo date("Y-m-d H:i:s",mktime(23,59,59,date("m"),date("t"),date("Y")));
标签:
原文地址:http://www.cnblogs.com/akidongzi/p/5832542.html