Core JavaScript 1.5 Reference:Global Objects:Date:now
From MDC
Contents |
[edit] Summary
Returns the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.
| Method of Date | |
| Static | |
| Not part of any standard | |
[edit] Syntax
var timeInMs = Date.now();
[edit] Parameters
None.
[edit] Description
The now method returns the milliseconds elapsed since 1 January 1970 00:00:00 UTC up until now as a number.
When using now to create timestamps or unique IDs, keep in mind that the resolution may be 15 milliseconds on Windows (see bug 363258), so you could end up with several equal values if now is called multiple times within a short time span.
[edit] Examples
[edit] Example: Using now
The following example uses now to create a timestamp.
var timestamp = Date.now();