[英]size of timestamp returned by strtotime in php
What is the size of timestamp returned by the strtotime() method in php? php中的strtotime()方法返回的时间戳大小是多少? I am guessing it 32 bit may be.
我猜可能是32位。 Is there any way to get a 64-bit timestamp from strtotime('now') in php?
有没有办法从PHP中的strtotime('now')获取64位时间戳?
Depends on which PHP architecture you're using. 取决于您使用的PHP体系结构。 32-bit PHP = 32-bit time stamps, 64-bit PHP = 64-bit time stamps.
32位PHP = 32位时间戳,64位PHP = 64位时间戳。
Suggested Solution regardless of architecture 建议解决方案,与体系结构无关
As mentioned by Mark Baker, using the DateTime
object is a safer bet. 如Mark Baker所述,使用
DateTime
对象是更安全的选择。 This avoids the use of architecture detection and provides a plethora of functionality. 这避免了使用体系结构检测,并提供了大量功能。
My understanding is that it will match the system you are on (and obviously if you are using the PHP 64bit binary); 我的理解是,它将与您所使用的系统匹配(很明显,如果您使用的是PHP 64位二进制文件); so if you are on a 32bit system it will be 32 and same for 64bit.
因此,如果您使用的是32位系统,则该值为32,而64位相同。
ie 即
strtotime("0000-00-00 00:00:00") returns FALSE on a 32 bit system. strtotime(“ 0000-00-00 00:00:00”)在32位系统上返回FALSE。
strtotime("0000-00-00 00:00:00") returns -62169955200 on a 64 bit system. 在64位系统上,strtotime(“ 0000-00-00 00:00:00”)返回-62169955200。
Same scenario for dates greater than the year 2038. See http://www.sitepoint.com/is-your-php-application-affected-by-the-y2k38-bug/ for a bit more info. 日期大于2038年的情况相同。有关更多信息,请参见http://www.sitepoint.com/is-your-php-application-affected-by-the-y2k38-bug/ 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.