substract one date from another
Posted: Wed Dec 16, 2009 4:53 am
hello guys i m really in a big trouble please help me...
i have two date dates i want to compare both with each other....
i m trying the following code, don't know wht's wrong in this:
i have two date dates i want to compare both with each other....
i m trying the following code, don't know wht's wrong in this:
Code: Select all
$date1 = "15/12/2009";
$date2 = "20/12/2009";
$dt1 = date("Y/m/d", strtotime($date1));
$dt2 = date("Y/m/d", strtotime($date2));
$cdt1 = strtotime($dt1);
$cdt2 = strtotime($dt2);
if($cdt1 > $cdt2)
echo "1st date is greater";
else
echo "2nd date is greater";