如何在PHP中查找上个月的开始和结束日期

时间:2011-04-04 06:48:47

标签: php

  

可能重复:
  Timestamps of start and end of month

我想在php中找到上个月的开始和结束日期(即)我想找到当月的上个月开始和结束日期

2 个答案:

答案 0 :(得分:32)

我想这会做

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

echo "<br/>";

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

答案 1 :(得分:4)

echo date('m-01',strtotime('last month')) . '<br/>';
echo date('m-t',strtotime('last month')) . '<br/>';
相关问题