📌  相关文章
📜  javascript 计算日期之间的天数 - Javascript 代码示例

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

代码示例1
function calculateDaysBetweenDates(date1, date2) {
  var oneDay = 24 * 60 * 60 * 1000;
  var date1InMillis = date1.getTime();
  var date2InMillis = date2.getTime();
  var days = Math.round(Math.abs(date2InMillis - date1InMillis) / oneDay);
  return days;
}