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 );