无影飞絮剑

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

 

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 } 
View Code

 

posted on 2015-12-31 17:27  无影飞絮剑  阅读(376)  评论(0编辑  收藏  举报