JS 求解时间差

 1     function UTCTimeDemo($str){  
 2         var d, s = "当前 UTC 时间为: ";   
 3         var c = ":";
 4             d = new Date($str);       
 5             s =  Date.parse(d); 
 6             return(s);
 7    }
 8    
 9    var t1 = UTCTimeDemo("2013-06-12");
10    var t2 = UTCTimeDemo("2013-06-19");
11    
12    document.write((t2-t1)/1000/60/60/24);
13 
14 =>7

 

posted @ 2013-06-19 22:44  justphp  阅读(186)  评论(0编辑  收藏  举报