我试图这样做:

$date_string = strtotime('6 Mar, 2011 23:59:59');

但我认为PHP由于某种原因无法解释,因为它返回了空值。我尝试了这个:
$date_string = strtotime('6 Mar, 2011 midnight');

以上工作正常,但我需要在午夜之前一秒钟,即一天的最后一秒。我如何在没有更改2011年3月6日部分的情况下获得strtotime退还这笔款项?

最佳答案

如果我使用March 6, 2011 23:59:59,它对我有用。有机会更改输入格式吗?

除此之外,您当然可以从时间戳中减去1秒。但是请注意,您需要使用3月7日:

$date_string = strtotime('7 Mar, 2011 midnight') - 1;

关于php - strtotime-午夜之前的一秒,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5212282/

10-16 15:32