var s1 = "2007-01-01";
var s2 = "2007-12-31";
s1 = s1.replace(/-/g, "/");
s2 = s2.replace(/-/g, "/");
s1 = new Date(s1);
s2 = new Date(s2);
var time= s1.getTime() - s2.getTime();
var days = parseInt(time / (1000 * 60 * 60 * 24));
alert("相差天数: " + days);
[ZZ]javascript比较日期相差天数
发帖者
bubble
时间:
9/08/2009 08:30:00 下午
订阅:
博文评论 (Atom)
0 评论:
发表评论