📌  相关文章
📜  javascript 获取两个日期之间的小时差 - Javascript 代码示例

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

代码示例1
// date1 and date2 are date objects

let hours = Math.abs(date1 - date2) / 36e5;

// The subtraction returns the difference between the two dates in milliseconds.
// 36e5 is the scientific notation for 60*60*1000, dividing by which converts
// the milliseconds difference into hours.