11-24-2011, 05:57 PM
I have a time_utilization column in my table. Now, I want to add the time depending on the two selected dates.
I tried the below query but not working.
$qry = "select SEC_TO_TIME(SUM(time_utilization)) from users where date between '2011-11-20' AND 2011-11-22";
11-24-2011, 07:14 PM
your example is not clear.
11-25-2011, 09:37 AM
Hi, I have a column call "time_utilization". This field holds the TIME in "hh:mm:ss" format. There are more than 15 rows in this column. Now, I want to add the time in this column to get the total time.
11-25-2011, 01:28 PM
There is a maximum value that TIME can hold, I believe it is around 825 hours, so if your total is above that amount it will round off to that value. See the manual for exact value.
11-25-2011, 01:35 PM
That's fine with me. How to do that. Can you please help me? Thank you.
11-26-2011, 12:12 AM
The big question: What is the *DATATYPE* of your time_utilization field??? If it is not DATETIME, then you will have to convert it.
11-27-2011, 04:06 PM
I converted the datatype as you specified. Now could you provide the exact syntax to add time. Also I tried the below code to test the time count works or not:
$qry = "select SEC_TO_TIME(SUM(TIME_TO_SEC(time_utilization))) from tracker";
$result=mysql_query($qry) or die (mysql_error());