PHP date(): How to go about doing this?

Chris B

New member
On my website, I have a staff log in page, in which every time the user logs in, the current date is stored in the database... for claiming the "Last Login". Now what I want to do is take the Last Login Date, compared to the current date, and find out how many days/weeks/months it has been.
Output something like this:
Bob - Last active: 5 days ago.
Joe - Last active: 1 month, 1 week, 2 days ago.

I know I have to subtract dates of some sort, but how would I do this?
Example code is appreciated.
10 points for best, thanks.
 
Back
Top