var oneDay = 24 * 60 * 60 * 1000; // hours*minutes*seconds*milliseconds
var firstDate = new Date(2013, 06, 30);
var secondDate = new Date(2013, 07, 01);
var diffDays = Math.round(Math.abs((secondDate.getTime() - firstDate.getTime()) / (oneDay)));
我运行上面的代码,答案应该是 1 天。但它给了我 2 天的时间。你能帮助我吗?