小编Bra*_*rts的帖子

为什么strftime('%G',strtotime('2017-01-01'))产生2016?

我在PHP 5.6中发现了一个可能的错误.strftime带参数的函数%G生成4位数年份.然而,它似乎回归错误的一年1483246800- 即2017年1月1日.它将返回2016年!

示例代码段:

echo strftime('%G', strtotime('2017-01-01'));
Run Code Online (Sandbox Code Playgroud)

这应该打印"2017",但我得到"2016".我正在运行PHP 5.6.这种边缘情况也出现在其他年份 - 例如2016-01-03输出2015而不是2016.

php strftime

2
推荐指数
1
解决办法
206
查看次数

标签 统计

php ×1

strftime ×1