-1

Possible Duplicate:
How do I calculate relative time?

I want to know how to display these data as seen on stackoverflow.com profile page. I have the timestamp of users registered date and last visit date. But I need to display using stackoverflow.com format.

For example:

Member since: 9 months
Last seen: just now

Is there any script to convert these dates and display in such format?

Community
  • 1
  • 1
Vivek
  • 4,526
  • 17
  • 56
  • 69

1 Answers1

1

This is a duplicate of this question which is a duplicate of this question which has some great code samples including PHP.

In addition to all this, if are you using jQuery you can do this client-side with something like the timeago plugin. It has the advantage of updating the text as time passes so if you load a page and it says "posted 5 minutes ago" and look again 5 minutes later, it says "posted 10 minutes ago"

Community
  • 1
  • 1
Chriszuma
  • 4,464
  • 22
  • 19
  • 1
    Good catch. But next time, consider flagging so a moderator can close with a link to that question... – Shog9 Sep 15 '11 at 21:56