JS date对象的减法处理

 

1 var time1="2010-11-01 10:12:12";
2 var time2="2010-11-01 11:12:12";
3
4 var t1=new Date(time1.replace(/-/g, '/'));
5 var t2=new Date(time2.replace(/-/g, '/'));
6
7 alert((t2-t1).toString()=="3600000"?"yes":"no");
8  

 

posted @ 2010-12-26 14:40  Devin Mao  阅读(585)  评论(0编辑  收藏  举报