/*
*
*函数功能:计算两个以YYYY-MM-DD为格式的日期,相差几天
*
*/
function getChaBetweenTwoDate($date1,$date2){
$Date_List_a1=explode("-",$date1);
$Date_List_a2=explode("-",$date2);
$d1=mktime(0,0,0,$Date_List_a1[1],$Date_List_a1[2],$Date_List_a1[0]);
$d2=mktime(0,0,0,$Date_List_a2[1],$Date_List_a2[2],$Date_List_a2[0]);
$Days=round(($d1-$d2)/3600/24);
return $Days;
}
echo getChaBetweenTwoDate('2010-08-11','2010-08-16');
echo "
";
echo getChaBetweenTwoDate('2010-08-16','2010-08-11');
?>