Skip to content

Instantly share code, notes, and snippets.

@0xB10C
Created March 30, 2018 11:19
Show Gist options
  • Save 0xB10C/276a319f6f0a0356de5bac18fa15e8e3 to your computer and use it in GitHub Desktop.
Save 0xB10C/276a319f6f0a0356de5bac18fa15e8e3 to your computer and use it in GitHub Desktop.
Creates an YYYY-MM-DD String from a Date
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