<?php function maketime($date) { list($year,$month,$day) = explode("-",$date); return mktime(0,0,0,$month,$day,$year); } $date1 = "2012-08-29"; $date2 = "2013-01-01"; $d = (maketime($date2) - maketime($date1)) / (3600*24); echo "$date1 - $date2<br /> 相差 $d 天"; ?>