Formating a time field using Avg
Hi I am trying to get an average reading on a time field so say for instance I have two values
I get the value 551 which is basically 1102 / 2 which is incorrect because the value I really want is 00:05:31. Has anyone got an idea how I can do this. Thanks in advance!
what dbms? what are the fields defined as in the db?
Its a mysql database and the name of the field is completetime. Apoligies
i don't care about the name of the field, what type is it defined as?
Assuming that it's defined as a TIME type, you probably want to use time_to_sec to convert the time type to a # of seconds and apply the average on that, then sec_to_time to convert the resulting seconds into a time format.
Thanks for that! I did put that the field was a time field on my first line
Hi I am trying to get an average reading on a time
field so say for instance I have two values
But you'd be amazed how many times people have a field called "date" or "time" that is a char/varchar or integer field.
Originally Posted by cs3mw
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
How to Ask Questions the Smart Way
(not affiliated with this site, but well worth reading)
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)