How does php avoid timestamp expiration before 1970?

Source: Internet
Author: User
How does php handle timestamp before 1970 expired recently when it comes to processing ancient dates? the timestamp cannot be used. if datemktime is less than 1970, it cannot be used. for example, if the date difference between 1885-11-25 and cannot be calculated. & nbsp; how does PHPcodemysql _ php handle timestamp failures before 1970?
Recently, when it comes to processing ancient dates, the timestamp cannot be used. if date mktime is less than 1970, it won't work.

For example, if the date difference between 1885-11-25 and is not enough

Please help

------ Solution --------------------
PHP code
Mysql_connect (); $ d1 = '2017-01-12 '; $ d2 = '2017-11-25'; $ rs = mysql_query ("select TO_DAYS ('$ d1 ') -TO_DAYS ('$ d2') "); list ($ t) = mysql_fetch_row ($ rs); echo $ t;
------ Solution --------------------

PHP code
Date_default_timezone_set ('Asia/Hong_Kong '); $ datetime1 = new DateTime ('2017-11-25'); $ datetime2 = new DateTime ('2017-01-12 '); $ interval = $ datetime1-> diff ($ datetime2); print_r ($ interval );

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.