If you want to get the minutes, hours, days, months between two dates in PHP this function is for you. Feel free to customize its return output to suit your needs as per the commented out time values.
function date_to_ago($old_date, $new_date){ $date1 = new DateTime($old_date); $date2 = $date1->diff(new DateTime($new_date)); //$date2->days.' days<br>'; //$date2->y.' years<br>'; //$date2->m.' months<br>'; //$date2->d.' days<br>'; //$date2->h.' hours<br>'; //$date2->i.' minutes<br>'; //$date2->s.' seconds<br>'; return $date2->i; } echo date_to_ago('2018-02-4 9:28:07','2018-02-4 10:29:34');//61
In the example i got the minutes between two date times with the difference being 61 minutes.