javascript - Trying to get 1 day or 2min ago from a timestamp in JS -


hi want auto convert timestamps things :

x min ago x hour ago x month ago

but dont know after :

function gettimeago(timestamp){  var = new date(timestamp*1000);  .. } 

i'm new javascript, has coded kind of function ?

thanks

timeago.js

what?

timeago jquery plugin makes easy support automatically updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). download, view examples, , enjoy.

you opened page less minute ago. (this update every minute. wait it.)

this page last modified month ago.

ryan born 34 years ago.

usage:

jquery.timeago(new date());             //=> "less minute ago" jquery.timeago("2008-07-17");           //=> "5 years ago" jquery.timeago(jquery("abbr#some_id")); //=> "5 years ago"     // [title="2008-07-20"] 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -