session login and logout time

Contributor
30Oct2010,07:29   #1
divinequran's Avatar
Hi,

I have to calculate login and logout time of an user. I store the session creation and session out time. How do I calculate the minutes or hours user have loged in. Do u have any code snippet for it?
Go4Expert Founder
30Oct2010,11:09   #2
shabbir's Avatar
What is the time storing unit. Is it unix time stamp?

Try this.
Code:
$beginTimeConverted=strtotime($beginTime);
$endTimeConverted=strtotime($endTime);

// perform subtraction
$timeDiff=$endTimeConverted-$beginTimeConverted;
Contributor
1Nov2010,07:42   #3
divinequran's Avatar
Thanks, It will help in writing the code.