sahilrajput.com

Epoch time (or Unix timestamp in milliseconds) made simple

Q. What is epoch time? Ans. Basically the number of milliseconds since midnight, 1970-01-01.

// Unix timestamp in milliseconds
k = Date.now() // 1674254700963

// making 
dateObject = new Date(k)

// date object to epoch time
l = dateObject.getTime() // 1674254700963

// testing
l === k
true

My other gist of javascript date testings

Click here