比较日期 结束日期不能早于开始日期
01.function getUserWorkId(CreateTime,SolveTime) 02.{ 03. 04. var DateOne = document.getElementById(CreateTime).value; 05. var DateTwo = document.getElementById(SolveTime).value; 06. 07. var OneMonth = DateOne.substring(5,DateOne.lastIndexOf ('-')); 08. var OneDay = DateOne.substring(DateOne.length,DateOne.lastIndexOf ('-')+1); 09. var OneYear = DateOne.substring(0,DateOne.indexOf ('-')); 10. 11. var TwoMonth = DateTwo.substring(5,DateTwo.lastIndexOf ('-')); 12. var TwoDay = DateTwo.substring(DateTwo.length,DateTwo.lastIndexOf ('-')+1); 13. var TwoYear = DateTwo.substring(0,DateTwo.indexOf ('-')); 14. var cha=((Date.parse(OneMonth+'/'+OneDay+'/'+OneYear)- Date.parse(TwoMonth+'/'+TwoDay+'/'+TwoYear))/86400000); 15. if(DateTwo.length>0) 16. { 17. if(cha>0) 18. { 19. alert('计划结束日期不能早于开始日期!'); 20. return false; 21. } 22. } 23.}