Skip to content
Advertisement

Difference between sum of hours and minutes using php

I want to calculate total number of hours and minutes difference with another total number of hours and minutes, For example:

JavaScript

so i want a way for calculating its difference like

JavaScript

As php strtotime is not converting it and also php date function is not working on this.

Advertisement

Answer

The answer is (based on the two inputs) 133:27, not 134:07.

In PHP, you can do the following with minimal data checking.

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement