jpser
Posts: 44
|
| Posted: 07/16/2007, 12:44 AM |
|
Mysql 5 / php 5:
columns : id, start_time, end_time, timediff(end_time,start_time)
group : id
How is it possible precisely, in a report to sum the timediff column
thanks for answer
JP from France
_________________
jp serei
|
 |
 |
mamboBROWN
Posts: 1713
|
| Posted: 07/17/2007, 8:24 PM |
|
jpser
exactly how do you wish to display the sum of time difference... in minutes, days or months??
More than likely you will need to convert the timediff into a format that can be easily added and then you may need to create some php code to put the sum into a readable format (before show).
|
 |
 |
jpser
Posts: 44
|
| Posted: 07/18/2007, 2:23 AM |
|
in details lines : we have to see : the timediff in Hours,Minutes,Seconds and to have a variable or hidden field
time_to_sec(timediff) in seconds (=fsec)
the problem is when calculating totals or sub_total in group,
how convert total seconds in Hours,Minutes,Seconds format
what php functions or ccs procedure to use ?
if i code a transform php function to do this and apply it in a beforeshow event , the reult is always wrong
for ex: fsec is totalised in seconds
$totsec = fsec;
$hours = floor($totsec/3600);
$mins = floor( ($totsec - ($hours * 60))/60);
$secs = $totsec - ($hours * 3600) - ($mins * 60);
$result = $hours." h ".$mins." m ".$secs." s ";
_________________
jp serei
|
 |
 |
mamboBROWN
Posts: 1713
|
| Posted: 07/18/2007, 2:56 PM |
|
jpser
If your information is in database format you could create a query that will do the adding for you in Mysql. You could use a combination of MySQL functions such as TIMESTAMPADD and TIME_FORMAT(time,format).
Or
You could also create a source query (for the report) that has fields (which are not visible on the report) but can be used to sum of the time. Maybe that field could be in minutes, which would be easy to add.
|
 |
 |
jpser
Posts: 44
|
| Posted: 07/19/2007, 2:08 PM |
|
Thank you so much for your quick and precious answer, that i shall analyse
_________________
jp serei
|
 |
 |
|