Date.parse
Parses a date string and returns a timestamp.
Available since: ES1
Syntax
Date.parse(dateString)Parameters
| Parameter | Type | Description |
|---|---|---|
| dateString | string | A date string, ideally in ISO format: 2026-03-15T10:30:00Z. |
Return value
numberA timestamp in milliseconds, or NaN if the string cannot be parsed.
Examples
A valid and an invalid string:
console.log(Date.parse('2026-03-15T00:00:00Z'));
console.log(Date.parse('next Friday'));Output:
1773532800000
NaNNotes
Only the ISO 8601 format is parsed reliably. Strings like 03/15/2026 are handled differently by browsers, and 15.03.2026 is not understood at all.
See also
- Date — A date and time: creating, reading parts, calculating.
- Date.prototype.getTime — Returns the date as a number of milliseconds.
Related recipes
In the tutorial
- Dates and time — The Date object in JavaScript: creating a date, reading the year, month and day, changing a date, the difference between dates and the ISO format.