Skip to content

Instantly share code, notes, and snippets.

@eto4detak
Created November 7, 2018 22:35
Show Gist options
  • Save eto4detak/8a41fac6e21ab9fd90398158dd644347 to your computer and use it in GitHub Desktop.
Save eto4detak/8a41fac6e21ab9fd90398158dd644347 to your computer and use it in GitHub Desktop.
js date
Date.prototype.yyyymmdd = function() {
var mm = this.getMonth() + 1; // getMonth() is zero-based
var dd = this.getDate();
return [this.getFullYear(),
(mm>9 ? '' : '0') + mm,
(dd>9 ? '' : '0') + dd
].join('/');
};
Jan02_1970.yyyymmdd()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment