javascript - How to use format() on a moment.js duration? - Stack Overflow

PHOTO EMBED

Tue Jan 18 2022 18:07:47 GMT+0000 (UTC)

Saved by @arielvol #javascript

// set up
let start = moment("2018-05-16 12:00:00"); // some random moment in time (in ms)
let end = moment("2018-05-16 12:22:00"); // some random moment after start (in ms)
let diff = end.diff(start);

// execution
let f = moment.utc(diff).format("HH:mm:ss.SSS");
alert(f);
content_copyCOPY

https://stackoverflow.com/questions/13262621/how-to-use-format-on-a-moment-js-duration