2011-04-04 50 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

相關問題