JavaScript Date now() method
- Vorherige Seite getUTCSeconds()
- Nächste Seite parse()
- Nach oben JavaScript Date Referenzhandbuch
Definition and usage
Date.now()
The method returns the number of milliseconds since 00:00:00 UTC on January 1, 1970.
Example
Example 1
Return the milliseconds since 1970/01/01:
var n = Date.now();
Example 3
Calculate the number of years since 1970/01/01:
var minutes = 1000 * 60; var hours = minutes * 60; var days = hours * 24; var years = days * 365; var t = Date.now(); var y = Math.round(t / years);
Syntax
Date.now()
Parameters
No parameters.
Technical details
Return value: | A number representing the milliseconds since midnight on January 1, 1970. |
---|---|
JavaScript version: | ECMAScript 5 (2009) |
Browser support
Methode | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
Date.now() | Unterstützung | 9 | Unterstützung | Unterstützung | Unterstützung |
- Vorherige Seite getUTCSeconds()
- Nächste Seite parse()
- Nach oben JavaScript Date Referenzhandbuch