Take the 2-minute tour ×
Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It's 100% free, no registration required.

Screenshot / Code Snippet

enter image description here

About

This script converts relative timestamps to absolute timestamps, displayed in your local time zone. For times less than one hour ago, I leave the "x mins ago" relative timestamp, because I think that is more useful in such short timeframes. In all cases, the tooltip is updated to an absolute, local timezone.

Download

Install | View source

Platform

Tested on Firefox 5.0 and Chrome 12.0, on Windows 7. Requires Greasemonkey on Firefox.

License

Do whatever you want, as long as you don't sell it or claim you wrote it. If you make any cool modifications, let me know!

Source

It seems that userscripts.org is dying. Here is the code:

// ==UserScript==
// @name           localized stackoverflow timestamps
// @namespace      stackoverflow
// @description    Converts relative timestamps on StackOverflow to absolute, localized timestamps. See more documentation at: http://meta.stackoverflow.com/questions/12635/
// @include       http://stackoverflow.com/*
// @include       http://meta.stackoverflow.com/*
// @include       http://superuser.com/*
// @include       http://meta.superuser.com/*
// @include       http://serverfault.com/*
// @include       http://meta.serverfault.com/*
// @include       http://askubuntu.com/*
// @include       http://meta.askubuntu.com/*
// @include       http://answers.onstartups.com/*
// @include       http://meta.answers.onstartups.com/*
// @include       http://nothingtoinstall.com/*
// @include       http://meta.nothingtoinstall.com/*
// @include       http://seasonedadvice.com/*
// @include       http://meta.seasonedadvice.com/*
// @include       http://crossvalidated.com/*
// @include       http://askdifferent.com/*
// @include       http://meta.crossvalidated.com/*
// @include       http://stackapps.com/*
// @include       http://*.stackexchange.com/*
// @exclude       http://chat.stackexchange.com/*
// @exclude       http://api.*.stackexchange.com/*
// @exclude       http://data.stackexchange.com/*
// @exclude       http://area51.stackexchange.com/*
// ==/UserScript==

(function() {

  function with_jquery(f) {
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.textContent = "(" + f.toString() + ")(jQuery)";
    document.body.appendChild(script);
  }; 

  with_jquery(function($) {
    //NOTE: Could be more efficient.  Need Jeff to fix this bug first:
    //  http://meta.stackoverflow.com/questions/12640/
    $("span.relativetime").each(updateTS);
    $("span.comment-date>span").each(updateTS);

    //pads number with leading 0 if needed
    function padNum(num) { return num < 10 ? "0"+num : num; }

    function updateTS() {
      var utcTimestamp = $(this).attr("title");
      var matches = utcTimestamp.match(/^([\d]{4})-([\d]{2})-([\d]{2}) ([\d]{2}):([\d]{2}):([\d]{2}) ?(?:Z|UTC|GMT(?:[+\-]00:?00))$/);

      if(matches == null)
        return;

      var date = new Date(
        Date.UTC(
          parseInt(matches[1], 10),
          parseInt(matches[2], 10) - 1,
          parseInt(matches[3], 10),
          parseInt(matches[4], 10),
          parseInt(matches[5], 10),
          parseInt(matches[6], 10)
        )
      );

      var newTimestamp = date.getFullYear() + "-"
                       + padNum(date.getMonth() + 1) + "-"
                       + padNum(date.getDate()) + " "
                       + padNum(date.getHours()) + ":"
                       + padNum(date.getMinutes()) + ":"
                       + padNum(date.getSeconds());


      $(this).attr("title", newTimestamp);
      if($(this).text().search(/(?:min|sec)s? ago/) == -1)
        $(this).text(newTimestamp);
    };

  });
})();
share|improve this question
    
userscripts.org is dead, if you saved it somewhere else can you edit the post? –  Shadow Wizard Jun 24 at 11:32
add comment

You must log in to answer this question.

Browse other questions tagged .