Answers for "how to get time with moment js"

3

javascript get time ago with moment

const dateTimeAgo = moment("2020-04-04 11:45:26.123").fromNow();
console.log(dateTimeAgo); //> 6 minutes ago
Posted by: Guest on April-04-2020
-2

how to get current time using moment

var startDate = moment().subtract(1, 'days'); //one day before the current time
Posted by: Guest on February-22-2021

Browse Popular Code Answers by Language