I'm using MySQL to pass a string that represents a time difference. It's formatted in H:M:S. I need to add all the numbers up into one total. So, I converted the times using strtotime and then added the numbers, then converted them back to H:M:S format to display.
The times are all off. In my test example, the total should end up being 9 hours and some minutes, but it's returning about 20 hours.
Does anyone know what I should be doing to accurately add strtotime values?
[g]
cameraman
4:48 pm on May 9, 2008 (gmt 0)
strtotime manipulates calendar dates and times of day; is the 20 maybe telling you 8:00 pm?
I would convert the values to seconds (H * 3600) + (M * 60) + S, then add them and break the result back into H:M:S.