Current Article:

How to parse a string to a date in JavaScript

How to parse a string to a date in JavaScript

The best string format for string parsing is the date ISO format together with the JavaScript Date object constructor.

Examples of ISO format: YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS.

The best practice should always be to store dates as UTC and make computations as UTC.

To parse a date as UTC, append a Z – e.g.: new Date('2025-07-11T11:00:00Z').

To display a date in UTC, use .toUTCString(),
to display a date in user’s local time, use .toString().