session login and logout time

divinequran's Avatar, Join Date: Oct 2008
Contributor
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?
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
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;
0
divinequran's Avatar, Join Date: Oct 2008
Contributor
Thanks, It will help in writing the code.