How to compare two dates in php if dates are in format \'03_01_12\'
and \'31_12_11\'
.
I am using this code:
$date1=date(\'
The date_diff() function returns the difference between two DateTime objects.
If the first date is before the second date a positive number of days will be returned; otherwise a negative number of days:
format("%R%a days");
?>
output will be "+272 days" ;
changing $date1 = "2014-03-15"
format("%R%a days");
?>
Output will be "-93 days"