views:

35

answers:

1

Hey,

I am trying to figure out how to find the average of a number of different time values, the time values are time differences from 2 dates so they will be in the format of "hh:mm:ss". So if I had 4 time values of:

00:11:05
00:01:30
00:04:25
00:09:50

I am having trouble figuring this out. I am thinking that these time values would need to be converted to some type of integer value then divided then converted back to this time format.

Any help is appreciated.

Thanks

+1  A: 
SELECT DATE_FORMAT(
    FROM_UNIXTIME(
         AVG(
              UNIX_TIMESTAMP(CONCAT('1980-01-01 ',timefield))
         )
    ),
    '%H:%i:%s.%f') FROM times;
Wrikken