I am trying to calculate difference between two dates in days, here are the two dates:
$date_1 = "2017-06-12 13:44:58";
$date_2 = "2017-05-04 19:06:24";
When I do it through PHP script it gives 38 as result, which is correct.
$datediff = strtotime($date_1) - strtotime($date_2);
echo floor($datediff / (60 * 60 * 24));
Result: 38 ----> Correct
Because there is still difference in hours of the given dates
But when I do the same in MySQL, then it gives 39 as result, which is wrong.
select DATEDIFF("2017-06-12 13:44:58","2017-05-04 19:06:24")
Result: 39 ----> Incorrect