JavaScript Date now() Method
- 上一页 getUTCSeconds()
- 下一页 parse()
- 返回上一层 Reference Manual ng JavaScript Date
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: | Number, representing the milliseconds since midnight on January 1, 1970. |
---|---|
JavaScript Version: | ECMAScript 5 (2009) |
Browser Supports
方法 | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
Date.now() | 支持 | 9 | 支持 | 支持 | 支持 |
- 上一页 getUTCSeconds()
- 下一页 parse()
- 返回上一层 Reference Manual ng JavaScript Date