我试过这个:
$date_string = strtotime('6 Mar, 2011 23:59:59');
但我认为 PHP 由于某种原因无法解释它,因为它返回空。我试过这个:
$date_string = strtotime('6 Mar, 2011 midnight');
上面的方法有效,但我需要它是午夜前的一秒,即一天的最后一秒。如何在不更改 2011 年 3 月 6 日部分的情况下让 strtotime 返回此内容?
最佳答案
希望这对您有所帮助。我使用了它,它在午夜前给出了今天的时间戳。违反直觉。
$today_timestamp = strtotime('tomorrow - 1 second');
关于php - strtotime - 午夜前一秒,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5212282/