moment format mm/dd/yyyy code example
Example 1: moment format date dd/mm/yyyy
moment(new Date()).format("DD/MM/YYYY")
Example 2: moment yyyy-MM-ddTHH:mm
moment().format("YYYY-MM-DD[T]HH:mm:ss");
Example 3: format a date moment
moment(testDate).format('MM/DD/YYYY');
Example 4: moment get day
var check = moment(n.entry.date_entered, 'YYYY/MM/DD');
var month = check.format('M');
var day = check.format('D');
var year = check.format('YYYY');
Example 5: moment.js format
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