我正在尝试让 strtotime 制作日期范围,我已经弄清楚了一些基本的。
这是我想弄清楚的一些内容,但我找不到您应该在网上任何地方为这些内容键入的格式:
$startDate = strtotime('first day of last month');
$endDate = strtotime('last day of last month');
$startDate = strtotime('first of last week');
$startDate = strtotime('first of this week');
这些是我唯一找不到参考的,它们可能需要特殊的编程并且没有strtotime
参考。
编辑:看起来我的代码应该可以工作,但 PHP 5.2 中有一个错误
我使用了一种解决方法来到达上个月的第一天。
这有效: $firstDayOfLastMonth = strtotime(date('Ym', strtotime('last month')))