Node.js examples for Date:Date Format
Date format without time
Date.prototype.toYMD = function () { return this.getFullYear() + '-' + (this.getMonth() + 1).toZeroPaddedString(2) + '-' + this.getDate().toZeroPaddedString(2); }; Date.prototype.toCalendarDate = function () { return { 'day':this.getDate(), 'month':this.getMonth(), 'year':this.getFullYear()}; }; Date.prototype.withoutTimeOfDay = function () { return new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0, 0); };