美文网首页
MomentJS计算两个时间的差值diff方法

MomentJS计算两个时间的差值diff方法

作者: 冰雪_666 | 来源:发表于2021-03-17 11:22 被阅读0次

    moment两个日期/时间的时差:开始时间和结束时间的时间差,以“天”为单位;endTime和startTime都是毫秒数

    
    moment(endTime).diff(moment(startTime), 'months')
    
    moment(endTime).diff(moment(startTime), 'days')   
    
    moment(endTime).diff(moment(startTime),'minutes' )
    
    moment(endTime).diff(moment(startTime), 'seconds')
    

    相关文章

      网友评论

          本文标题:MomentJS计算两个时间的差值diff方法

          本文链接:https://www.haomeiwen.com/subject/vjiscltx.html