how to get current date in moment js code example

Example 1: moment to date

moment().toDate();

Example 2: format a date moment

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

Example 3: timestamp convert moment vue

var day = moment.unix(1318781876); //seconds
var day = moment(1318781876406); //milliseconds

// and then:

console.log(day.format('dddd MMMM Do YYYY, h:mm:ss a'));

// "Sunday October 16th 2011, 9:17:56 am"

Example 4: how to get current time using moment

var startDate = moment().subtract(1, 'days'); //one day before the current time