时间:2021-07-01 10:21:17 帮助过:21人阅读
mysql_connect(); $d1 = '1901-01-12'; $d2 = '1885-11-25'; $rs = mysql_query("select TO_DAYS('$d1')-TO_DAYS('$d2')"); list($t) = mysql_fetch_row($rs); echo $t;
------解决方案--------------------
date_default_timezone_set('Asia/Hong_Kong'); $datetime1 = new DateTime('1885-11-25'); $datetime2 = new DateTime('1901-01-12'); $interval = $datetime1->diff($datetime2); print_r($interval);