I have a set of intime and outtime, and i want to calculate the duration between the intime and outtime and add all the duration to get the total duration.
example:
Array
(
[1] => Array
(
['intime'] => 1342086993
['outime'] => 1342087585
)
[3] => Array
(
['intime'] => 1342087669
['outtime] => 1342096165
)
[5] => Array
(
['intime'] => 1342096339
['outime'] => 1342096345
)
)
$total_duration = 0;
foreach($logArray as $log)
{
$duration = $log['outime'] - $log['intime'];
$total_duration += $duration;
}
$duration_hrs = $total_duration/3600;
echo 'Time spend in hrs :'.$duration_hrs;
but this is not giving me the proper duration. is there any other way to do so.