JSFiddle - React, Tailwind, and code Playground
JavaScript
console.log(dateToEpoch(new Date()));
console.log(dateToEpoch(new Date(1408704590485)));
console.log(dateToEpoch(new Date()));
console.log(dateToEpoch(new Date(1408704590485)));
function dateToEpoch(thedate) {
var time = thedate.getTime();
return time - (time % 86400000);
}
function dateToEpoch2(thedate) {
return thedate.setHours(0,0,0,0).getTime();
}