List of utility methods to do Date Serialize
serialize()Date.get = function( str ){ var arr = str.split("-"), d = new Date(); d.setFullYear( arr[0], arr[1] - 1, arr[2] ); d.setHours(0,0,0,0); return d; }; Date.prototype.serialize = function(){ var m = this.getMonth() + 1; ... | |
serialize_date()Date.prototype.serialize_date = function(){ var month = (Number(this.getMonth()) + 1); if (month.toString().length === 1){ month = "0" + month.toString(); var day = (Number(this.getDate()) + 1); if (day.toString().length === 1){ day = "0" + day.toString(); return this.getFullYear() + "-" + month + "-" + day; }; |