Jump to content

Calculating the difference between two dates


MortimerJazz

Recommended Posts

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.