Convert Timestamp to Time ago using jQuery timeago

The “timeago” is a highly configurable jQuery plugin to convert timestamp to time ago. It helps you to convert both past and future dates to “time ago”. It gets the timestamp from HTML time tag. Process it and return time ago string e.g less than minute ago, 5 minutes ago, week, year ago etc.

jQuery timeago Plugin Overview

Plugin: timeago
Author: Ryan McGeary
Category: Date & Time
Published: January 20, 2024
File Type: zip archive (HTML, CSS & JavaScript )
Package Size: 9 KB
Dependencies: jQuery 3.0 or Latest version
Last Modified:

How to Convert Timestamp To Time Ago

1. To convert timestamps, we need to getting started with jQuery timeago plugin. So, first of all load the jQuery into your HTML document.

<!-- jQuery -->
<script src=""></script>

2. After that, include the timeago’s JavaScript file in your website/app.

<!-- timeago JS -->
<script src="js/jquery.timeago.js"></script>

3. Create HTML time tag with class name "timeago" and place your timestamp in it.

<time class="timeago" datetime="2019-11-27T09:24:17Z">November 27, 2019</time>

4. Finally, initialize the plugin with time.timeago selector in jQuery document ready function.


For more advance usage, please check the Configurations Options tab.

Advance Configuration Options for jQuery timeago Plugin

The following are some advanced configuration options to convert timestamp to time ago.

Option Default Type Description
refreshMillis 60000 Number Milliseconds after update timestamp.


	refreshMillis : 60000,
allowPast true Boolean Enable / disable past for date.


	allowPast : true,
allowFuture false Boolean Decide whether to enable timeago for future dates. True for enable.


	allowFuture : false,
localeTitle false Boolean Decide whether to use locale time for converting date to time ago.


	localeTitle : false,
autoDispose true Boolean This option enable / disable auto dispose.


	autoDispose : true,
strings Shown in example String Set of values for time ago string.


	strings :  {
        prefixAgo: null,
        prefixFromNow: null,
        suffixAgo: "ago",
        suffixFromNow: "from now",
        inPast: 'any moment now',
        seconds: "less than a minute",
        minute: "about a minute",
        minutes: "%d minutes",
        hour: "about an hour",
        hours: "about %d hours",
        day: "a day",
        days: "%d days",
        month: "about a month",
        months: "%d months",
        year: "about a year",
        years: "%d years",
        wordSeparator: " ",
        numbers: []



  • Updated v.1.6.7


  • Initial release
About CodeHim

Free Web Design Code & Scripts - CodeHim is one of the BEST developer websites that provide web designers and developers with a simple way to preview and download a variety of free code & scripts. All codes published on CodeHim are open source, distributed under OSD-compliant license which grants all the rights to use, study, change and share the software in modified and unmodified form. Before publishing, we test and review each code snippet to avoid errors, but we cannot warrant the full correctness of all content. All trademarks, trade names, logos, and icons are the property of their respective owners... find out more...

Please Rel0ad/PressF5 this page if you can't click the download/preview link