Last active
September 29, 2015 00:37
-
-
Save shuhei/1520434 to your computer and use it in GitHub Desktop.
Show military time instead of pretty date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); }); })(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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