robpal
robpal

Reputation: 834

php or jquery date

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 ?

Upvotes: 2

Views: 106

Answers (1)

jmav
jmav

Reputation: 3149

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"]

Upvotes: 4

Related Questions