Javascript Convert Date Time string to Epoch
var someDate = new Date(dateString);
someDate = someDate.getTime();
You can use Date.parse(date)
.
function epoch (date) {
return Date.parse(date)
}
const dateToday = new Date() // Mon Jun 08 2020 16:47:55 GMT+0800 (China Standard Time)
const timestamp = epoch(dateToday)
console.log(timestamp) // => 1591606075000