在解决一个奇怪的错误后,我遇到了这个:
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/