Return the number of milliseconds between January 1, 1970 and March 21, 2012:
The result of d will be:
The parse() method parses a date string and returns the number of milliseconds between the date string and midnight of January 1, 1970.
![]()
The parse() method is supported in all major browsers.
| Parameter | Description |
|---|---|
| datestring | Required. A string representing a date |
| Type | Description |
|---|---|
| Number | Milliseconds between the specified date-time and midnight January 1, 1970 |
| JavaScript Version: | 1.0 |
|---|
Calculate the number of years between January 1, 1970 to March 21, 2012:
result of y will be:
JavaScript Date Object
Your message has been sent to W3Schools.