Calculating the difference between two time MomentJS method diff

Two date / time difference:

moment(endTime).diff(moment(startTime), ‘years’)

moment(endTime).diff(moment(startTime), ‘months’)

moment (endTime) .diff (moment (startTime), 'days') // start and end times of the time difference, "day" as a unit; startTime and endTime milliseconds are

moment(endTime).diff(moment(startTime),‘minutes’ )

moment(endTime).diff(moment(startTime), ‘seconds’)

Published 128 original articles · won praise 3 · Views 2552

Guess you like

Origin blog.csdn.net/qq_26642611/article/details/104492062