How to show last login time ( year,month,week,day,time,sec).. i tried but Wrong output
<p>$lastLoginTime = date("Y-m-d H:i:s"); //last login which will store in DB during login</p>

<p>assume Last login is: 2012-05-11 07:57:46 <BR>
Current Time is: $current_time  = date("Y-m-d H:i:s")</p>

<pre><code>    $diff_seconds  = strtotime($current_time) - strtotime($lastLoginTime);
    $diff_weeks    = floor($diff_seconds/604800);
    $diff_seconds -= $diff_weeks   * 604800;
    $diff_days     = floor($diff_seconds/86400);
    $diff_seconds -= $diff_days    * 86400;
    $diff_hours    = floor($diff_seconds/3600);
    $diff_seconds -= $diff_hours   * 3600;
    $diff_minutes  = floor($diff_seconds/60);
    $diff_seconds -= $diff_minutes * 60;



    echo "You last logged in $diff_weeks weeks, $diff_days days, ";
    echo "$diff_hours hours, $diff_minutes minutes, and $diff_seconds minutes ago.";
</code></pre>

<p>Wrong Output....! 
:-(</p>
