Created
December 11, 2016 10:54
-
-
Save kn9ts/88699ff38263c5984950ccb6b4671165 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// USAGE | |
// var newDate = new Date(); | |
// var datetime = "LastSync: " + newDate.today() + " @ " + newDate.timeNow(); | |
// For todays date; | |
Date.prototype.today = function() { | |
return ((this.getDate() < 10) ? "0" : "") + this.getDate() + "/" + (((this.getMonth() + 1) < 10) ? "0" : "") + (this.getMonth() + 1) + "/" + this.getFullYear(); | |
} | |
// For the time now | |
Date.prototype.timeNow = function() { | |
return ((this.getHours() < 10) ? "0" : "") + this.getHours() + ":" + ((this.getMinutes() < 10) ? "0" : "") + this.getMinutes() + ":" + ((this.getSeconds() < 10) ? "0" : "") + this.getSeconds(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment