PHP Strtotime 上个月第 5 天
PHP Strtotime 5th day last month
如何使用 strtotime()
查找上个月第五天的午夜?我知道可以使用strtotime('midnight first day of last month');
找到第一天
只需组合使用语句即可。 DateTime()
非常适合这种情况,因为您可以链接方法(而且它也是可读的):
$timestamp = (new DateTime('midnight first day of last month'))->modify('+5 days')->getTimestamp();
strtotime('midnight first day of last month') + (60*60*24*5);
尝试 *5
或 *4
,然后继续阅读 strtotime
。
strtotime
以秒为单位,因此您可以在几秒钟内添加任意天数。
如何使用 strtotime()
查找上个月第五天的午夜?我知道可以使用strtotime('midnight first day of last month');
只需组合使用语句即可。 DateTime()
非常适合这种情况,因为您可以链接方法(而且它也是可读的):
$timestamp = (new DateTime('midnight first day of last month'))->modify('+5 days')->getTimestamp();
strtotime('midnight first day of last month') + (60*60*24*5);
尝试 *5
或 *4
,然后继续阅读 strtotime
。
strtotime
以秒为单位,因此您可以在几秒钟内添加任意天数。