Skip to content

Instantly share code, notes, and snippets.

@linus-amg
Created September 26, 2014 15:30
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 linus-amg/ffe88f1475552130c78d to your computer and use it in GitHub Desktop.
Save linus-amg/ffe88f1475552130c78d to your computer and use it in GitHub Desktop.
console.log(new Date().time(),'[INFO]','Testing...');
Number.prototype.pad = function (len) {
return (new Array(len+1).join('0') + this).slice(-len);
};
Date.prototype.time = function () {
var dateMS = this;
return dateMS.getHours().pad(2)+':'+dateMS.getMinutes().pad(2)+':'+dateMS.getSeconds().pad(2);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment