moment().unix() // you will get a unix timestamp
moment().valueOf() // you will get a full timestamp
const moment = require('moment');
const timestamp = 1519482900000;
const formatted = moment(timestamp).format('L');
console.log(formatted); // "02/24/2018"
moment('2016-10-11T14:36:03+02:00').format("x"); // output : 1476189363
var CurrentDate = moment().valueOf();
function formatDateTime(dateString) {
const parsed = moment(new Date(dateString))
if (!parsed.isValid()) {
return dateString
}
return parsed.format('MMM D, YYYY, HH:mmA')
}
function formatDateTime(dateString) {
const parsed = moment(new Date(dateString))
if (!parsed.isValid()) {
return dateString
}
return parsed.format('MMM D, YYYY, HH:mmA')
}