Behold this awesome scripts that will make your timestamp web development much easier...

timeago

The first one (a jquery plugin) enable us to automatically update timestamps in html sites. It's very useful for keeping relative timestamps up to date.

Other advantages are:

  • Reduce server cpu usage: this script will run on the client's side.
  • Allow caching of your webpage: the changes are made on the browser and the server response is "always" the same.

A small example:

<time class="timeago" datetime="2012-09-10T14:30:52-0300">September 10, 2012</time>;
$(document).ready(function() {
$("time.timeago").timeago();
});
The result is a formatted timestamp that automatically updates itself.

this post was published.

The official site explains more in detail what the plugin does, why it is useful, where to use it and how to do so. It also gives support to different languages for the dates to be displayed.

moment.js

This javascript library provides a great way to display and format dates in a website (at the client's side), letting user choose from different languages available and see how quickly the dates are updated according to the new localization. Fully documented and with lots of examples of where to use it and code snippets.

Comments: