Javascript Date serialize_date()
Date.prototype.serialize_date = function(){ var month = (Number(this.getMonth()) + 1); if (month.toString().length === 1){ month = "0" + month.toString(); }/*from w w w . j ava2 s . c om*/ var day = (Number(this.getDate()) + 1); if (day.toString().length === 1){ day = "0" + day.toString(); } return this.getFullYear() + "-" + month + "-" + day; };