moment实现计算两个时间的差值

var m1 = moment(‘2018-08-14 11:00:00‘),
m2 = moment(‘2018-08-14 12:10:00‘);
console.log(m1)
console.log(m2)
console.log(m2.diff(m1, ‘minute‘));

minute为分钟,可更改为秒或毫秒,具体看官方说明
文章来自:https://www.cnblogs.com/licurry/p/9476351.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3