Javascript Date getFormatDateTime()
Date.prototype.getFormatDateTime = function () { var pad = function (number) { if ( number < 10 ) { return '0' + number; }//from w w w . ja v a 2 s. co m return number; } return this.getFullYear() + '-' + pad( this.getMonth() + 1 ) + '-' + pad( this.getDate() ) + ' ' + pad( this.getHours() ) + ':' + pad( this.getMinutes() ); };