2011-04-04 76 views

回答

3
echo date('m-01',strtotime('last month')) . '<br/>'; 
echo date('m-t',strtotime('last month')) . '<br/>'; 
+0

尼斯的答案,就可以得到当月的开始和结束日也:'$ FROM日期=日期(“YM- 01',strtotime('this month')); \t \t $ toDate = date('Y-m-t',strtotime('this month'));' – 2017-11-09 10:31:00

24

我想这会做

echo date('Y-m-d', strtotime('first day of last month')); 

echo "<br/>"; 

echo date('Y-m-d', strtotime('last day of last month')); 
+0

似乎是一个笑话,但它确实有效!魔法! – joseantgv 2017-11-06 15:33:08

相关问题