可能重复:
How to calculate the difference between two dates using PHP?
如何计算日期之间的差异?
是否有任何默认函数来计算日期差异?..
由于
拉维
答案 0 :(得分:3)
示例:
$datetime1 = date_create('2009-10-11');
$datetime2 = date_create('2009-10-13');
$interval = date_diff($datetime1, $datetime2);
echo $interval->format('%R%a days');
答案 1 :(得分:0)
$date1 = date("Y/m/d");
$comp_date = "2010/12/1";
if($date1 <= $comp_date)//-------- if for date is less than limit
{
}
else if($date1 > $comp_date)//---------ElseIf for date is greator than limit
{
}//----End else if($date1 > $comp_date)
}//--------- End Main if
您也可以尝试这种方法......