php - strtotime 对于遥远 future 的日期的奇怪行为

标签 php strtotime

在解决一个奇怪的错误后,我遇到了这个:

echo strtotime("2050/09/19");

返回错误

为什么?

谢谢!

最佳答案

看起来您没有 64 位 PHP。来自strtotime文档:

Note:

The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 UTC to Tue, 19 Jan 2038 03:14:07 UTC. (These are the dates that correspond to the minimum and maximum values for a 32-bit signed integer.) Additionally, not all platforms support negative timestamps, therefore your date range may be limited to no earlier than the Unix epoch. This means that e.g. dates prior to Jan 1, 1970 will not work on Windows, some Linux distributions, and a few other operating systems. PHP 5.1.0 and newer versions overcome this limitation though.

For 64-bit versions of PHP, the valid range of a timestamp is effectively infinite, as 64 bits can represent approximately 293 billion years in either direction.

关于php - strtotime 对于遥远 future 的日期的奇怪行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7982671/

相关文章:

PHP strtotime() 不输出任何内容

php - ReflectionObject vs. cast to array vs. get_object_vars 用于检索公共(public)变量

javascript - 图表.js v2.6 : Add arrows to pie chart output values

php - Eclipse Xdebug 卡住在 57%

php - 使用 php 和 Mysql 更改 Strftime 日期

php - 如何检查时间数组的单个值是否在另一个时间的 +/- 15 分钟范围内

php - 根据选项组和选项计算产品变体

PHP 可以使用 static::replace self::吗?

php - 最好的方法是如何简单地创建日历?

PHP:解析任何格式的日期(尤其是:2008-10-20、2008/10/20、2008.10.20、Nov. 20/08)