Date.now method
The Date.now method returns the
number of milliseconds that have passed
since midnight 1 January 1970
until the current moment. This date
format is called timestamp.
Syntax
Date.now();
Example
Let's output the number of milliseconds
that have passed since 1
January 1970:
let res = Date.now();
console.log(res);
See also
-
the
getTimemethod
that also obtains the timestamp -
the
Date.parsemethod
that returns the date from a string