Possible Duplicate:
How to calculate the difference between two dates using PHP?
How to calculate difference between the dates?
Is there a开发者_开发知识库ny default function for to calculate the date differences?..
Thanks
Ravi
date_diff()
example:
$datetime1 = date_create('2009-10-11');
$datetime2 = date_create('2009-10-13');
$interval = date_diff($datetime1, $datetime2);
echo $interval->format('%R%a days');
$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
You can try this method too...
精彩评论