<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>javascript014.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<script type="text/javascript">
/*
* 2013-3-3 2013-4-6
*/
function dateDemo() {
var date1 = "3-3-2013";
var date2 = "2-6-2013";
/*
* 实现思路: 1. 将字符串转成日期对象 Date对象的parse方法,月日年 2. 毫秒值的减法运算
*/
var time1 = Date.parse(date1);
var time2 = Date.parse(date2);
alert((Math.abs(time2 - time1)) / 1000 / 60 / 60 / 24);
// alert(Date.parse(date1));
// alert(Date.parse(date2));
}
dateDemo();
</script>
</head>
<body>
</body>
</html>