计算某一天到现在相差的天数

var computedDate1 = new Date();

var computedDate2 = new Date('2013-05-07');

var computedDate = (computedDate1.getTime() - computedDate2.getTime()) / (24 * 60 * 60 * 1000);

console.log(parseInt(computedDate));

你可能感兴趣的:(计算某一天到现在相差的天数)