This article mainly introduces how to solve the problem of the timestamp in PHP in 2038. if you need it, you can refer to the typical timestamp range of the valid timestamp in PHP: December 13, 1901 20:45:54 to January 19, 2038 03:14:07 GMT. (The value range is the minimum and maximum values of 32-bit signed integers ). However, before PHP 5.1, this range was limited in some systems (such as Windows) from January 1-20, 1970 to January 19.
The 64-bit system will not be affected. if the 32-bit system is used, the new DateTime solution can be used.
The code is as follows:
$ Date = '2017-10-01 ';
$ Datetime = new DateTime ($ date );
Echo'
Normal time: ', $ datetime-> format ('Y-m-d H: I '),'
';
Echo'
Time overflow: ', date ('Y-m-d H: I', strtotime ($ date )),'
';
As there are still a lot of win2003 servers, the applicability of this solution is quite wide and I hope you will like it.