How to get time in milliseconds since the Unix epoch in JavaScript?


The standard Unix epoch is an expression in seconds. The Unix epoch or Unix time is the number of seconds elapsed since January 1, 1970.

The getTime() method is used to return the millisecond representation of the Date object.

To get time in milliseconds, use the following:

var milliseconds = (new Date).getTime();

Updated on: 24-Sep-2019

879 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements