js moment to date code example
Example 1: javascript get time ago with moment
const dateTimeAgo = moment("2020-04-04 11:45:26.123").fromNow();
console.log(dateTimeAgo);
Example 2: moment to date
moment().toDate();
Example 3: moment format date
moment().format();
moment().format("dddd, MMMM Do YYYY, h:mm:ss a");
moment().format("ddd, hA");
Example 4: moment js from now
moment(date).fromNow();
Example 5: moment js get french time 20:00:00
moment().format();
moment().format("dddd, MMMM Do YYYY, h:mm:ss a");
moment().format("ddd, hA");
moment('gibberish').format('YYYY MM DD');
Example 6: moment to javascript date
let now = moment()
let now = now.toDate()