Date.prototype.isLeapYear = function () { return Date.isLeapYear(this.getFullYear()); };
Date.prototype.getDaysInMonth = function () { return Date.getDaysInMonth(this.getFullYear(), this.getMonth()); };
Date.prototype.addMonths = function (value) { var n = this.getDate(); this.setDate(1); this.setMonth(this.getMonth() + value); this.setDate(Math.min(n, this.getDaysInMonth())); return this; }; Date.prototype.addDays = function(days) { var date = new Date(this.valueOf()); date.setDate(date.getDate() + days); return date; } //时间格式化 年月日时分秒 function dateymdhis(value){ var date = new Date(value); var y = date.getFullYear(); var m = date.getMonth() + 1; m=(m+'').length==2? m:'0'+m; var d = date.getDate(); d=(d+'').length==2? d:'0'+d; var h=date.getHours(); h=(h+'').length==2? h:'0'+h; var min=date.getMinutes(); min=(min+'').length==2? min:'0'+min; var s=date.getSeconds(); s=(s+'').length==2? s:'0'+s; return y + '-' +m + '-' + d + ' '+ h + ':' +min + ':' + s; }