CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.

YesSoftware Forums -> Archive -> GotoCode Archive

 Calculate hours

Print topic Send  topic

Author Message
Posted: 11/18/2003, 2:05 PM

How to calculate hours

Using php+mysql

in the table i have a timeonline and timeoffline

i want to calculate the hours+minuts spent between

I'm using custom code BeforeShowRow

global $NewGrid1;

I must be doing something wrong, because i'm not getting any results
Posted: 11/24/2003, 9:24 AM

Use the functions in mysql to do this for you. The database is a lot faster at this stuf then php.
Assuming you enter the time in the hours:minutes format:

$TimeGrid->time_spent->SetValue(CCGetDBValue("SELECT sec_to_time( time_to_sec(" .$TimeGrid->offline_time->GetValue() .")- time_to_sec(" .$TimeGrid->online_time->GetValue() ."))",$DBConnection1);


Posted: 12/10/2003, 6:21 AM

I get a parse error with the code form Ron.

Did you solve it.

Posted: 12/12/2003, 1:38 AM

$TimeGrid->time_spent->SetValue(CCGetDBValue("SELECT sec_to_time( time_to_sec(" .$TimeGrid->offline_time->GetValue() .")- time_to_sec(" .$TimeGrid->online_time->GetValue() ."))",$DBConnection1));

I think it was missing an ) sorry :-)



These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit

Web Database

Join thousands of Web developers who build Web applications with minimal coding.

Home   |    Search   |    Members   |    Register   |    Login

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