📌  相关文章
📜  在javascript代码示例中计算两个日期之间的时间差

📅  最后修改于: 2022-03-11 15:02:18.937000             🧑  作者: Mango

代码示例2
const date1 = new Date('7/13/2010');
const date2 = new Date('12/15/2010');
const diffTime = Math.abs(date2 - date1);
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)); 
console.log(diffTime + " milliseconds");
console.log(diffDays + " days");