How to deal with a problem in PHP with a timestamp of 2038 _ PHP Tutorial

Source: Internet
Author: User
Tags php example
PHP was later than the 2038 timestamp. A typical timestamp in PHP that is used to solve the problem of timestamp in November is from 20:45:54 GMT, January 1, to 03:14:07 GMT. (Solution for solving the problem with the 2038 timestamp in This PHP example

A typical timestamp of PHP is from 20:45:54, January 1, December 13, 1901 to 03:14:07, January 1, January 19, 2038, Greenwich Mean Time. (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.

Explain the question processing solution for timestamps in January 2038. The typical timestamps of PHP are from 20:45:54, January 1, December 13, 1901 to 03:14:07, January 1, January 19, 2038, Greenwich Mean Time. (This example...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.