Why do timestamps have a limit to 2038?

后端 未结 4 1818
-上瘾入骨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:14

    The maximum value of a 32-bit integer is 2,147,483,647. If you add +1 to that, you get -2,147,483,647. 2,147,483,647 seconds from 01-01-1970 00:00:00 is January 19, 2038. If you add one more second, you get a date somewhere in 1902.

提交回复
热议问题