<script>var st="2009-10-20 14:38:40"var et="2009-10-20 15:38:40"var stdt=new Date(st.replace("-","/"))var etdt=new Date(et.replace("-","/"))if(stdt>etdt) alert("开始时间必须小于结束时间")</script>
第二种:直接比较大小即可
<script>var st="2009-10-20 14:38:40"var et="2009-10-20 15:38:40"if(st>et) alert("开始时间必须小于结束时间")</script>
可以用用Date.parse()方法var d1 = Date.parse('2014-09-28 19:00:00'),
d2 = Date.parse('2014-09-28 2:00:00')
console.log(d1 > d2)