I would store the time they logged in as a session variable like
$_SESSION['loginTime'] = new DateTime(date('y-m-d h:m:s'));
Then calculate the difference with diff
.
Get the current time
$difference= $_SESSION['loginTime']->diff(new DateTime(date('y-m-d h:m:s')));
Then you can output time since with these methods
echo $difference->y; //return the difference in Year(s).
echo $difference->m; //return the difference in Month(s).
echo $difference->d; //return the difference in Day(s).
echo $difference->h; //return the difference in Hour(s).
echo $difference->i; //return the difference in Minute(s)
echo $difference->s; //return the difference in Second(s).