Created
March 30, 2018 11:19
-
-
Save 0xB10C/276a319f6f0a0356de5bac18fa15e8e3 to your computer and use it in GitHub Desktop.
Creates an YYYY-MM-DD String from a Date
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
Date.prototype.toYYYYMMDDString = function () { | |
return this.getFullYear() + "-" + ("0" + (this.getMonth()+1)).slice(-2) + "-" + ("0" + this.getDate()).slice(-2); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment