MortimerJazz Posted January 15, 2007 Share Posted January 15, 2007 I'm trying to calculate the number of hours/days/weeks since a particular user has logged into the website.Here's what I've got so far. The last_login variable comes from the database.[code]$current=gmdate('d-m-Y H:i');$last_login=date("m/d/Y", strtotime($last_login));$difference=$current-$last_login;echo "Seller last login: $difference";}[/code]Unfortunately, that doesn't seem to be working. All I'm getting is a big fat "0" being printed on the screen.Can someone tell me where I'm going wrong? Link to comment https://forums.phpfreaks.com/topic/34335-calculating-the-difference-between-two-dates/ Share on other sites More sharing options...
The Little Guy Posted January 16, 2007 Share Posted January 16, 2007 This might help you out: http://viplyrics.com/tzfiles/phpcode/age_calculator.php <- it calculates years, you may need to modify it though, it also starts with the example first Link to comment https://forums.phpfreaks.com/topic/34335-calculating-the-difference-between-two-dates/#findComment-161590 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.