momment js code example
Example 1: moment format date
moment().format();
moment().format("dddd, MMMM Do YYYY, h:mm:ss a");
moment().format("ddd, hA");
Example 2: momentjs
npm install moment --save # npm
yarn add moment # Yarn
moment.locale();
moment().format('LT');
moment().format('LTS');
moment().format('L');
moment().format('l');
moment().format('LL');
moment().format('ll');
moment().format('LLL');
moment().format('lll');
moment().format('LLLL');
moment().format('llll');
Example 3: javascript moment
m = moment('2013-03-01', 'YYYY-MM-DD')
Example 4: moment
moment("20111031", "YYYYMMDD").fromNow();
moment("20120620", "YYYYMMDD").fromNow();
moment().startOf('day').fromNow();
moment().endOf('day').fromNow();
moment().startOf('hour').fromNow();
Example 5: moment js
moment().subtract(Number, String);
moment().subtract(Duration);
moment().subtract(Object);
Example 6: momentjs docs
npm install moment