var time1 = new Date(d1.replace("-", "/").replace("-", "/"));var time2 = new Date(d2.replace("-", "/").replace("-", "/"));if(time1 > time2)alert("time1 大於 time2");date1=new Date("12-11-2000"); date2=new Date("12-12-2000"); alert("日期差值為:"+(date2-date1));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 ("-"));(Date.parse(OneMonth+"/"+OneDay+"/"+OneYear) >Date.parse(TwoMonth+"/"+TwoDay+"/"+TwoYear))更多專業的科普知識,歡迎關注我。如果喜歡我的回答,也請給我贊或轉發,你們的鼓勵,是支援我寫下去的動力,謝謝大家。
var time1 = new Date(d1.replace("-", "/").replace("-", "/"));var time2 = new Date(d2.replace("-", "/").replace("-", "/"));if(time1 > time2)alert("time1 大於 time2");date1=new Date("12-11-2000"); date2=new Date("12-12-2000"); alert("日期差值為:"+(date2-date1));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 ("-"));(Date.parse(OneMonth+"/"+OneDay+"/"+OneYear) >Date.parse(TwoMonth+"/"+TwoDay+"/"+TwoYear))更多專業的科普知識,歡迎關注我。如果喜歡我的回答,也請給我贊或轉發,你們的鼓勵,是支援我寫下去的動力,謝謝大家。