convert date to milliseconds code example
Example 1: epoch
Epoch timestamp is a unit of measurement for time. It is the number of
seconds elapsed since the countdown has started.
Beginning epochs per system:
macOS - January 1, 1904
Windows - January 1, 1601
Unix - January 1, 1970
Example 2: You can then use the number of milliseconds to convert it to a date object:
var msec = Date.parse("March 21, 2012");
var d = new Date(msec);
document.getElementById("demo").innerHTML = d;