Hey all...

Working on a time calculation for a tracking system.. time ON the apge..
time OFF the page type of thing..

Anyway.. everything as far as entering the time values, etc is working
correctly except the calculation is NOT working as it should!!!

here is my code for the calculation

 
/* Get the timeIn value for the corresponding page ID */


$getTimeQuery = db_query("SELECT timeIn FROM PagesViewedTable WHERE
cookieValue='$_COOKIE[RINKRAKE]' AND id='$_SESSION[timeId]'");

$getTime = mysql_result($getTimeQuery, 0);

$timeDifference = $time - $getTime;

$timeValue = date("g:i:s", $timeDifference);

 
Now... the DB part pulls the timeOut value from the DB for the
corresponding pageID.

Next I assign a variable to subract the timeOut value from the $time
variable ($time was set using date("U"); and it does work0

Next I get the hour:minute:seconds of the between the timeOut and $time

I have code to echo output to a browser for debugging...
 
/* echo codes */
 
echo 'The timeIn value is: '.$getTime.'<br>';
echo 'The timeOut value is: '.$time.'<br>';
echo 'The converted timeIn value is '.date("g:i:s", $getTime).'<br>';
echo 'The converted timeOut value is '.date("g:i:s", $time).'<br>';
echo 'The time difference between timeIn and timeOut is:
'.$timeValue.'<br>';
 
When I echo everything out to the browser this is what I get:

The timeIn value is: 1033760057
The timeOut value is: 1033760098
The converted timeIn value is 3:34:17
The converted timeOut value is 3:34:58
The time difference between timeIn and timeOut is: 7:00:41

You see.. the 7 is there... which represents 7 hours and 41 seconds that
have elapsed. the 41 seconds is right.. but not the 7 hours!!!

ANY thoughts?

Pleeease.

Thanks !

Reply via email to