Time difference in words: jQuery fuzzy timestamps plugin – timeago

Show time difference in words with timeago – a jQuery fuzzy timestamps plugin.

The “timeago” plugin – jQuery fuzzy timestamps

A jQuery plugin that makes it easy to support automatically updating fuzzy timestamps, for example:

“5 minutes ago

“You opened this page 15 minutes ago”

“Commented 2 hours ago”

“He was born 44 years ago”


We can take full advantage of page caching in web applications, because the timestamps aren’t calculated on the server.

jQuery timeago plugin - time difference in words
jQuery timeago plugin – time difference in words


We get to use standard HTML5 tags. First, load jQuery and the plugin:

<script src="jquery.min.js" type="text/javascript"></script>
<script src="jquery.timeago.js" type="text/javascript"></script>

Start the plugin:

jQuery(document).ready(function() {

This will turn all time elements with a class of timeago and an ISO 8601 timestamp in the datetime:

<time class="timeago" datetime="2009-07-17T09:24:17Z">
  July 17, 2009

We can also use it programmatically:

jQuery.timeago(new Date());             //=> "less than a minute ago"
jQuery.timeago("2008-07-17");           //=> "8 years ago"
jQuery.timeago(jQuery("time#some_id")); //=> "8 years ago"
                                        // [title="2008-07-20"]

License: MIT

Docs and examples @ project homepage:


Get jQuery fuzzy timestamps plugin from GitHub:


See also:

jQuery countdown timer plugins

Analog and digital jQuery world clock plugin – jClocksGMT.js

A simple jQuery number counter plugin – counter.js

Material time picker library – a timer picker written in ES6 and SASS