• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calculate Average of time HH:MM MySql Php

#1
Hello,

I have a table with time field that stores 24hr. time duration in HH:MM format, 
need help to calculate Average of time values across the table.

Example:
03:15
05:13
10:20

Any help would be appreciated.
Reply

#2
@ebaad,

When you save average time...do you mean by the hour or hour and minutes?
Reply

#3
(08-27-2018, 03:06 PM)php_rocs Wrote: @ebaad,

When you save average time...do you mean by the hour or hour and minutes?

Thanks, I am looking to get average time in HH:MM format to show the Min, Max and Average time to respond on events.
Reply

#4
(08-27-2018, 03:22 PM)ebaad Wrote:
(08-27-2018, 03:06 PM)php_rocs Wrote: @ebaad,

When you save average time...do you mean by the hour or hour and minutes?

Thanks, I am looking to get average time in HH:MM format to show the Min, Max and Average time to respond on events.

Hello, I hope this helps you:

SELECT SEC_TO_TIME(AVG(TIME_TO_SEC(`hours`))) FROM `table_name`

[Image: tabla_1.PNG]


[Image: tabla_2.PNG]
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.