Formatting Dates and Times
Display dates with Intl.DateTimeFormat.
Intl.DateTimeFormat
Intl.DateTimeFormat formats Date objects according to a locale, replacing brittle manual string building.
const dtf = new Intl.DateTimeFormat("en-US");
console.log(dtf.format(new Date("2026-05-29"))); // "5/29/2026"Locale Differences
Date order differs by region: US is month/day/year, much of Europe is day/month/year.
const d = new Date("2026-05-29");
console.log(new Intl.DateTimeFormat("en-US").format(d)); // 5/29/2026
console.log(new Intl.DateTimeFormat("en-GB").format(d)); // 29/05/2026All lessons in this course
- Formatting Numbers and Currency
- Formatting Dates and Times
- Relative Time and Plurals
- Locale-Aware Sorting