I have two dates with times like this:

Start date/time = 2006-01-01 08:12
End date/time = 2006-01-07 10:45

I want to take the End date/time and subtract Start date/time from it.
I want the results in days, hours and minutes.

Like this example:

4 days, 3 hours and 52 minutes.

How do I do that in PHP?

    get the time in seconds for both using strtotime(), then substract the number of starting date seconds from ending. you will then get the total difference in number of seconds between the 2 dates. you can then divide them by 60 to get mins, or again to get hours, then by 24 to get days etc.

      Write a Reply...