How to get Timestamp in Javascript

Last Updated: October 4, 2019

The timestamp in JavaScript is expressed in milliseconds
In UNIX timestamp, you have the timestamp in second counting from 1970

If you are given the timestamp you can use the following code to get the date string

   var dateString = moment.unix(1332111600).format("MM/DD/YYYY");
   console.log(dateString)

You can use the following code to get the timestamp form the date object

var timestamp = moment('03/19/2012','MM/DD/YYYY').toDate().getTime()
console.log(timestamp)