This is my query:
SELECT TIMEDIFF(end_time,start_time) AS "total" FROM `metrics`;
which gives me:
116:12:10
meaning 116 hours, 12 minutes and 10 seconds.
Instead, I want it to say 4 days 20 hours, 12 minutes etc
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use your end_time and start_time for the fixed datetime values in my example
As per the two comments below, this solution only works for date differences within 35 days. If you know there are more than 35 days between start and end, i.e. differences over a month, don’t use it. Other answers here using TIMESTAMPDIFF will work.