Solution for "new moment js"

moment(testDate).format('MM/DD/YYYY');

format a date moment

moment().format('ddmmyyyyhhmmss'); // May 6th 2021, 2:30:08 pm // 2021-05-06T14:30:08+05:30

moment js

npm install moment

momentjs docs

moment("20111031", "YYYYMMDD").fromNow(); // 9 years ago moment("20120620", "YYYYMMDD").fromNow(); // 8 years ago moment().startOf('day').fromNow(); // 13 hours ago moment().endOf('day').fromNow(); // in 11 hours moment().startOf('hour').fromNow(); // 4 minutes ago

moment.js format

moment().subtract(Number, String); moment().subtract(Duration); moment().subtract(Object);

moment js

Similar codes for "new moment js"


Latest 'Javascript' questions

Added before "new moment js"