首页 > Web开发 > 详细

js日期比较

时间:2015-12-31 19:04:29      阅读:214      评论:0      收藏:0      [点我收藏+]

 

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

 

js日期比较

原文:http://www.cnblogs.com/itslives-com/p/compareDate.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!