2

how can i make date format from this :

1138618081 ( with php function time() )

to this :

4 years 11 months 25 days 3 hours 10 minutes 25 seconds ago

maybe I can do this with jQuery or Ajax and it will updating automaticly every 2 minutes ?

robpal
  • 846
  • 4
  • 10
  • 21
  • 1
    Question was already asked http://stackoverflow.com/questions/5722919/jquery-convert-number-to-date – Adam Merrifield Nov 16 '11 at 14:52
  • @Adam, gordon33 is interested in getting string "4 years 11 months 25 days 3 hours 10 minutes 25 seconds ago" not just conversion – jmav Nov 16 '11 at 14:58

1 Answers1

4

Use http://timeago.yarp.com plugin.

jQuery.timeago(new Date());             //=> "less than a minute ago"
jQuery.timeago("2008-07-17");           //=> "3 years ago"
jQuery.timeago(jQuery("abbr#some_id")); //=> "3 years ago"     // [title="2008-07-20"]
jmav
  • 3,119
  • 4
  • 27
  • 27