PHP求两个日期相差的天数
时间:2021-07-01 10:21:17
帮助过:13人阅读
- function maketime($date)
- {
- list($year,$month,$day) = explode("-",$date);
- return mktime(0,0,0,$month,$day,$year);
- }
- $date1 = "2015-01-01";
- $date2 = "2015-01-05";
- $d = (maketime($date2) - maketime($date1)) / (3600*24);
- echo "$date1 - $date2
相差 $d 天"; - ?>
|
PHP