Get the time difference between two datetimes

前端 未结 19 2266
花落未央
花落未央 2020-11-22 05:25

I know I can do anything and some more envolving Dates with momentjs. But embarrassingly, I\'m having a hard time trying to do something that seems simple: geting the differ

19条回答
  •  滥情空心
    2020-11-22 05:50

    var a = moment([2007, 0, 29]);
    var b = moment([2007, 0, 28]);
    a.diff(b, 'days') //[days, years, months, seconds, ...]
    //Result 1 
    

    Worked for me

    See more in http://momentjs.com/docs/#/displaying/difference/

提交回复
热议问题