Skip to content

Instantly share code, notes, and snippets.

@shuhei
Last active September 29, 2015 00:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shuhei/1520434 to your computer and use it in GitHub Desktop.
Save shuhei/1520434 to your computer and use it in GitHub Desktop.
Show military time instead of pretty date
javascript:(function() { function pad(num) { return ("0" + num.toString()).slice(-2); } $('time').each(function() { var $this = $(this), d = new Date($this.attr('datetime')), str = pad(d.getMonth() + 1) + "/" + pad(d.getDate()) + " " + pad(d.getHours()) + ":" + pad(d.getMinutes()); $this.text(str); }); })();
(function() {
function pad(num) {
return ("0" + num.toString()).slice(-2);
}
$('time').each(function() {
var $this = $(this),
d = new Date($this.attr('datetime')),
str = pad(d.getMonth() + 1) + "/" + pad(d.getDate()) + " " + pad(d.getHours()) + ":" + pad(d.getMinutes());
$this.text(str);
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment