1 |
- (function(a){Date.prototype.format=function(c){var d={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};if(/(y+)/.test(c)){c=c.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length))}for(var b in d){if(new RegExp("("+b+")").test(c)){c=c.replace(RegExp.$1,RegExp.$1.length==1?d[b]:("00"+d[b]).substr((""+d[b]).length))}}return c};Date.prototype.toDate=function(b){var d=b.split("-");var c=new Date();c.setFullYear(d[0]);c.setMonth(parseInt(d[1])-1);c.setDate(parseInt(d[2]));return c};Date.prototype.getWeekDay=function(c){var b=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];var f=c.split("-");var e=new Date();e.setFullYear(f[0]);e.setMonth(parseInt(f[1])-1);e.setDate(parseInt(f[2]));var d=e.getDay();return b[d]}})(Zepto);
|