码迷,mamicode.com
首页 > Web开发 > 详细

js-比较两个日期的大小

时间:2016-02-22 17:37:55      阅读:119      评论:0      收藏:0      [点我收藏+]

标签:

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>

<body>
<script>
function CompareDate(d1,d2)
{
  return ((new Date(d1.replace(/-/g,"\/"))) > (new Date(d2.replace(/-/g,"\/"))));
}

var current_time = "2007-2-2 7:30";
var stop_time = "2007-1-31 8:30";
alert(CompareDate(current_time,stop_time));

</script>
</body>
</html>

 

js-比较两个日期的大小

标签:

原文地址:http://www.cnblogs.com/hwaggLee/p/5207684.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!