CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 sum time

Print topic Send  topic

Author Message
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
View profile  Send private message
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).
View profile  Send private message
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
View profile  Send private message
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.
View profile  Send private message
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
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.