Time Calculation

Status
Not open for further replies.

symcom

New Member
I want to calculate the time in a calc element between A and B using:

A = {pgs8r_liondata___fire_detection} (date element)
B = {pgs8r_liondata___fire_reportignition} (date element)

From what I could find on the forums I tried:

$date = strtotime ('{pgs8r_liondata___fire_detection}');
$date1 = strtotime ('{pgs8r_liondata___fire_ignition}');
$diff = $date - $date1;
return $diff;

Will appreciate some guidance to achieve this.
 
seems right to me, what results are you seeing?
Have you checked the data that is contained in {pgs8r_liondata___fire_detection} ?
Have you tried {pgs8r_liondata___fire_detection_raw} instead?
 
Thanks Rob, tried _raw but same result
Below is the results and data -
pgs8r_liondata___fire_detection | data = "2012-04-22 19:30"
pgs8r_liondata___fire_ignition | data = "2012-04-22 17:45"
result data = "-1335109500"
 
Code:
$d = strtotime('2012-04-22 19:30');
$d2 = strtotime('2012-04-22 17:45');
$diff = $d - $d2;
echo $diff;
gives me :

Code:
6300

are you doubly sure that you are actually getting the values in the place holders?
 
Try changing your return value to ...

PHP:
return $diff . " ({pgs8r_liondata___fire_detection}, {pgs8r_liondata___fire_reportignition})";

... and see what that yields, just to check what those placeholders are set to. If you get something like [array] instead of a value, try adding _raw to the names, and see what you get.

-- hugh
 
Thank you Rob & Hugh problem has been solved.

Did an un-install, removed tables and then a new install with latest SVN.

Now the work can start.
 
Status
Not open for further replies.

Members online

No members online now.
Back
Top