Calculate average call time

Asked

Viewed 2,522 times

1

Guys, I need to take the average attendance time and I have the following data:

00:12:35
00:05:10
00:01:42
00:08:12
00:01:01
{...}

The question is, how can I do it? I searched for a way to do it using Mysql AVG but I was unsuccessful... I tried to add and divide by the amount of records but the number was broken... Someone has gone through something similar?

Thanks in advance for the help!

  • take a look at this link https://answall.com/questions/127231/calcular-diff%C3%A7a-entre-horas-no-php

  • Possible duplicate of Calculate time difference in php

  • The above comment solves your problem. Since it teaches removing the difference between hours and the average time of care is the sum of the differences divided by the amount of care.

1 answer

1

Average with integer values by converting times to seconds and then converting to time type again:

SELECT SEC_TO_TIME(AVG(TIME_TO_SEC(`tempo_atendimento`)))

Browser other questions tagged

You are not signed in. Login or sign up in order to post.