alert(EDate< new Date().format("yyyy-MM-dd hh:mm:ss"));
1 Date.prototype.format = function(format){ 2 var o = { 3 "M+" : this.getMonth()+1, //month 4 "d+" : this.getDate(), //day 5 "h+" : this.getHours(), //hour 6 "m+" : this.getMinutes(), //minute 7 "s+" : this.getSeconds(), //second 8 "q+" : Math.floor((this.getMonth()+3)/3), //quarter 9 "S" : this.getMilliseconds() //millisecond 10 } 11 12 if(/(y+)/.test(format)) { 13 format = format.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length)); 14 } 15 16 for(var k in o) { 17 if(new RegExp("("+ k +")").test(format)) { 18 format = format.replace(RegExp.$1, RegExp.$1.length==1 ? o[k] : ("00"+ o[k]).substr((""+ o[k]).length)); 19 } 20 } 21 return format; 22 }
posted on 2015-12-31 17:27 阅读( ...) 评论( ...) 收藏