moment js milliseconds now with hours minutes seconds code example
Example 1: create moment duration
moment.duration(2, 'seconds');
moment.duration(2, 'minutes');
moment.duration(2, 'hours');
moment.duration(2, 'days');
moment.duration(2, 'weeks');
moment.duration(2, 'months');
moment.duration(2, 'years');
moment.duration('2', 'years');
moment.duration({
seconds: 2,
minutes: 2,
hours: 2,
days: 2,
weeks: 2,
months: '2',
years: '2'
});
moment.duration('P1Y2M3DT4H5M6S');
moment.duration('P1M');
moment.duration('7 23:59:59.999');
Example 2: momentjs docs
npm install moment