Why do timestamps have a limit to 2038?

后端 未结 4 1830
-上瘾入骨i
-上瘾入骨i 2020-11-30 05:59

I just found out, running a calendar script, that timestamps in PHP has a limit to 2038. What does it really mean? Why is it 2038 instead of 2050 or 2039? Why a limit if tim

4条回答
  •  醉酒成梦
    2020-11-30 06:20

    due to the limit of INT datatype on 32 bit machine

    http://php.net/manual/en/function.mktime.php

    From php.net : "The maximum possible date accepted by mktime() and gmmktime() is dependent on the current location time zone.

    For example, the 32-bit timestamp overflow occurs at 2038-01-19T03:14:08+0000Z. But if you're in a UTC -0500 time zone (such as EST in North America), the maximum accepted time before overflow (for older PHP versions on Windows) is 2038-01-18T22:14:07-0500Z, regardless of whether you're passing it to mktime() or gmmktime()."

提交回复
热议问题