php - 在“T”之后使用空格时 php strtotime() 出现意外结果
问题描述
在日期/时间字符串中的“T”之后插入空格时(在 Debian 上使用 PHP 7.1),我注意到 strtotime() 函数的奇怪行为。
我越来越:
strtotime('1970-01-01 00:00:00Z') = 0 //as expected
strtotime('1970-01-01T00:00:00Z') = 0 //as expected
strtotime('1970-01-01 T 00:00:00Z') = 25200 //7 hours more...
strtotime('1970-01-01T00:00:00-12:00') = 43200 //as expected
strtotime('1970-01-01 T 00:00:00-12:00') = 25200 //Same as before...
受影响的行不严格遵守(因为空格)http://php.net/manual/en/datetime.formats.compound.php中报告的格式,一个快速的解决方案是去掉时间字符串中的所有空格,但我对函数的行为感到惊讶:7 小时(25200 秒)从何而来?
解决方案
推荐阅读
- scala - 用于服务器流式传输的 Akka Streams(gRPC、Scala)
- python - 如何从 scikit-learn 玩具数据集中预测数据
- excel - 当用户决定不更改 excel vba 中的选择时,如何反转下拉选择?
- swift - 初始化不调用属性包装器的覆盖类函数
- c# - DateTime.TryParse 在 Linux 和 Windows 上的行为不同
- sql - 通过在 Oracle SQL 中以特定顺序组合一列值来选择唯一记录
- javascript - 单个下拉菜单中的多项选择
- eggplant - 茄子功能 r21 反应迟缓/无响应
- c# - c#在JSON数据字符串中包含一个变量
- javascript - 单击即可更新所有按钮。反应JS