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 ?

2
  • 1
    Question was already asked stackoverflow.com/questions/5722919/… Commented Nov 16, 2011 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 Commented Nov 16, 2011 at 14:58

1 Answer 1

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"]
Sign up to request clarification or add additional context in comments.

1 Comment

Was this answer helpful Robertas?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.