用javascript比较日期

function compareDate(DateOne,DateTwo){ 
         var OneMonth = DateOne.substring(5,DateOne.lastIndexOf ("-")); 
         var OneDay = DateOne.substring(DateOne.length,DateOne.lastIndexOf ("-")+1); 
         var OneYear = DateOne.substring(0,DateOne.indexOf ("-")); 
        
         var TwoMonth = DateTwo.substring(5,DateTwo.lastIndexOf ("-")); 
         var TwoDay = DateTwo.substring(DateTwo.length,DateTwo.lastIndexOf ("-")+1); 
         var TwoYear = DateTwo.substring(0,DateTwo.indexOf ("-")); 
        
         if (Date.parse(OneMonth+"/"+OneDay+"/"+OneYear) >= Date.parse(TwoMonth+"/"+TwoDay+"/"+TwoYear)){ 
         return true; 
         }else{ 
         return false; 
         } 
     } 
阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页