Below function takes starting date time and ending date time as parameters and returns the time interval in minutes.
Function
function differenceInMinutes($from_time, $to_time) { $to_time = strtotime($to_time); $from_time = strtotime($from_time); $minutes=round(abs($to_time-$from_time) / 60, 2); return str_replace('.',':',$minutes); }
Calling The Function
echo differenceInMinutes('2018-06-03 09:10:10', '2018-06-03 15:00:10');
Output
350
Leave A comment
Email address is optional and will not be published. Only add email address if you want a reply from blog author.
Please fill required fields marked with *