session login and logout time

Discussion in 'PHP' started by divinequran, Oct 30, 2010.

  1. divinequran

    divinequran New Member

    Joined:
    Oct 9, 2008
    Messages:
    62
    Likes Received:
    1
    Trophy Points:
    0
    Occupation:
    Software Engineer
    Home Page:
    http://divinequran.com/
    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?
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,336
    Likes Received:
    377
    Trophy Points:
    83
    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;
     
  3. divinequran

    divinequran New Member

    Joined:
    Oct 9, 2008
    Messages:
    62
    Likes Received:
    1
    Trophy Points:
    0
    Occupation:
    Software Engineer
    Home Page:
    http://divinequran.com/
    Thanks, It will help in writing the code.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice