How to calculate the difference between two dates in php?
The date_diff() is an inbuilt function in PHP which is used to calculate the difference between two dates.
1. Code:
format('%R%a');
}
$mySqlDate1 = "2018-11-15 00:00:00";
$mySqlDate2 = "2018-11-5 00:00:00";
echo(getDifferenceBetweenTwoDates($mySqlDate1, $mySqlDate2));
?>
2. Example:
Input:
"2018-11-15 00:00:00" "2018-11-5 00:00:00"
Output:
-10