Skip to content
Advertisement

How to calculate the time consumed from start time to end time in php

I want to get the perfect time consumed or the total time from start time to end time:
My code:

JavaScript

In the code above if $start_time = 11:00:00 PM and $end_date =11:30:00 it gives me the output of 0.5 instead of 30minutes. Is there any appropriate way to do it like that?
So if the:

JavaScript

or:

JavaScript

Regards!

Advertisement

Answer

Try diff function

JavaScript

Output


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