Possible Duplicate:
Calculate DateDiff in SQL in Days:Hours:Mins:Seconds format
I have this MySql query:
SELECT DATEDIFF(MAX(hit_date), MIN(hit_date)) / (COUNT(hit_date) - 1) AS hitavg FROM my_table
This returns a value (average days between recorded rows from hit_date column, this column is in TIMESTAMP format, so YY:MM:DD HH:MM:SS)
Assuming that this value is 385.500 (returned from the query), how can I format in PHP this number as 385 Days, “n” Hours (where “n” is the decimal value, in this case 500)?
Thanks in advance to all!
Well, if you only want Days and Hours, then: