offline version v3


140 of 264 menu

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 getTime method
    that also obtains the timestamp
  • the Date.parse method
    that returns the date from a string
enru