now()  Date  class method JS Home  <<  JS Reference  <<  Date  <<  now()

Description

Returns an integer value representing the milliseconds elapsed since 1 January 1970 00:00:00 UTC.

  • Like all class methods now() should be used on the class rather than an instance of the class.

Syntax

Signature Description
Date.now()Returns an integer value representing the milliseconds elapsed since 1 January 1970 00:00:00 UTC.

Parameters

None.

Examples

The code below shows an example of the now() method of Date.



// Show elapsed time in milliseconds.
alert(Date.now() + ' = Milliseconds since 1 January 1970 00:00:00 UTC.')

Press the button below to action the above code:

Related Tutorials

JavaScript Intermediate Tutorials - Lesson 2 - Dates and Times