php - strtotime - 午夜前一秒

标签 php

我试过这个:

$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/

相关文章:

php - Laravel 5.4 升级,从 utf8 转换为 utf4mb

php - 从具有某种模式的 mysql 数据库构建家谱

PHP:打印关联数组

php - mysql_fetch_array()/mysql_fetch_assoc()/mysql_fetch_row()/mysql_num_rows等…期望参数1为资源或结果

php - 如何获取sql中null和number中的最大值为null?

javascript - 如何将 dataTables 的 "aLengthMenu"值转换为 PHP 变量?

php - !empty() 对于值 0.0000 结果为 true

javascript - 编辑每周的开放和关闭时间(每天)

php - 简单的背景颜色 css jquery 切换循环

php - 在 Codeigniter 3 中扩展 session 库