- <script language="JavaScript">
- function getInfo(a,b)
- {
- if(compare(a,b)){
- alert("a>=b");
- }else
- {
- alert("a<b");
- }
- }
- function compare(a,b)
- {
- alert("a = "+a);
- alert("b = "+b);
- var time_a = a.split('-');
- var time_b = b.split('-');
- alert(time_a[0]);
- if(parseInt(time_a[0])<parseInt(time_b[0]))
- {
- return false;
- }
- else if(parseInt(time_a[1])==parseInt(time_b[1]))
- {
- if (parseInt(time_a[1])<parseInt(time_b[1]))
- {
- return false;
- }
- else if(parseInt(time_a[1])==parseInt(time_b[1]))
- {
- if(parseInt(time_a[2])<=parseInt(time_b[2]))
- {
- return false;
- }
- }
- }
- return true;
- }
- </script>
时间比较
最新推荐文章于 2025-08-19 08:41:01 发布