To get the number of milliseconds since Unix epoch
, call Date.now
Date.now()
The valueOf()
method returns the primitive value of a Date
object.
Alternatively, use the unary operator +
to call Date.prototype.valueOf
+ new Date()
The valueOf()
method returns the primitive value of a Date
object.
Alternatively, call valueOf
directly:
new Date().valueOf()