Intl.DateTimeFormat
Formats dates and times by language rules.
Available since: ES2015 (Intl)
Syntax
new Intl.DateTimeFormat(locales, options)Parameters
| Parameter | Type | Description |
|---|---|---|
| locales | string | Optional. The language and region, for example en-US or de-DE. |
| options | object | Optional. dateStyle, timeStyle, weekday, year, month, day, hour, minute, timeZone and others. |
Return value
Intl.DateTimeFormatAn object with the format(), formatRange() and formatToParts() methods.
Examples
One formatter for many dates:
const formatter = new Intl.DateTimeFormat('en-US', { dateStyle: 'long' });
console.log(formatter.format(new Date(2026, 2, 15)));
console.log(formatter.format(new Date(2026, 11, 31)));Output:
March 15, 2026
December 31, 2026Ready-made styles and separate parts:
const date = new Date(2026, 2, 15, 18, 5);
console.log(new Intl.DateTimeFormat('de-DE', { dateStyle: 'full', timeStyle: 'short' }).format(date));
console.log(new Intl.DateTimeFormat('en-US', { month: 'short', day: 'numeric' }).format(date));Output:
Sonntag, 15. März 2026 um 18:05
Mar 15A date range:
const formatter = new Intl.DateTimeFormat('en-US', { month: 'long', day: 'numeric' });
console.log(formatter.formatRange(new Date(2026, 2, 15), new Date(2026, 2, 20)));Output:
March 15 – 20Notes
Creating a formatter once and calling format() many times is faster than calling toLocaleDateString() each time. The user's time zone comes from Intl.DateTimeFormat().resolvedOptions().timeZone.
See also
- Date.prototype.toLocaleDateString — Formats a date without time by language rules.
- Date.prototype.toLocaleString — Formats a date together with the time by language rules.
- Intl.RelativeTimeFormat — Formats relative time: 3 days ago, in 1 hour.
Related recipes
In the tutorial
- Formatting with Intl — Locale-aware formatting of numbers, money, dates and plural words in JavaScript: toLocaleString, Intl.NumberFormat, Intl.DateTimeFormat and Intl.PluralRules.