Home JavaScript Intl Methods Intl.DateTimeFormat() Definition new Intl.DateTimeFormat(locales, options) builds a formatter that turns a Date into a locale-aware string. Call format(date) for one string, or formatToParts(date) for labeled pieces.
Always pass a fixed Date and often timeZone: "UTC" in tutorials so the printed result does not depend on the machine clock or local zone.
new Intl.DateTimeFormat(locales, options)
fmt.format(date)
fmt.formatToParts(date)
timeZone: "UTC" → stable across machines
options: year, month, day, hour, minute... Syntax Create a formatter with a locale and options, then call format.
const d = new Date(Date.UTC(2024, 5, 15, 12, 0, 0));
const fmt = new Intl.DateTimeFormat("en-US", { timeZone: "UTC" });
console.log(fmt.format(d)); Call What it does new Intl.DateTimeFormat("en-US", { timeZone: "UTC" })US English date style in UTC. fmt.format(date)One formatted string for the date. fmt.formatToParts(date)An array of { type, value } pieces. { hour: "2-digit", minute: "2-digit" }Control which time fields appear.
A standard JavaScript constructor on the Intl object: create one with new Intl.DateTimeFormat(). No import required. Siblings: Intl.getCanonicalLocales() , Intl.supportedValuesOf() , Intl.Collator() , Intl.DisplayNames() , Intl.DurationFormat() , Intl.ListFormat() , Intl.Locale() , Intl.NumberFormat() , Intl.PluralRules() , Intl.RelativeTimeFormat() , Intl.Segmenter() .
Library declarations // ECMAScript 2015 — Intl.DateTimeFormat
new Intl.DateTimeFormat(locales, options)
fmt.format(date)
fmt.formatToParts(date)
// options.timeZone, year, month, day, hour, minute, ... Parameters Parameter Description locales Optional. Locale string or list, such as "en-US" or "de-DE". options Optional. Fields such as timeZone, year, month, day, hour, minute. date For format / formatToParts: a Date (or timestamp).
Return Value Return Value Description DateTimeFormat object From the constructor. string From format. object[] From formatToParts: each part has type and value.
JavaScript Examples 1. en-US vs de-DE 2. Time options 3. formatToParts Example 1 — Same Instant, Two Locales Format one fixed UTC date in American and German styles.
const d = new Date(Date.UTC(2024, 5, 15, 12, 0, 0));
const opts = { timeZone: "UTC" };
console.log("en-US: " + new Intl.DateTimeFormat("en-US", opts).format(d));
console.log("de-DE: " + new Intl.DateTimeFormat("de-DE", opts).format(d)); en-US: 6/15/2024
de-DE: 15.6.2024 How It Works Fixed instant. Month 5 means June because months are 0-based in the Date constructor.UTC zone. Both formatters use timeZone: "UTC" so the calendar day stays 15 June.Different order. US style is month/day/year; German style uses day.month.year.Example 2 — Format Hours and Minutes Ask only for a 24-hour clock time in UTC.
const d = new Date(Date.UTC(2024, 5, 15, 12, 0, 0));
const fmt = new Intl.DateTimeFormat("en-US", {
timeZone: "UTC",
hour: "2-digit",
minute: "2-digit",
hour12: false
});
console.log("Time: " + fmt.format(d)); How It Works Pick fields. Only hour and minute are requested, so no date appears.hour12: false. Forces a 24-hour clock for a stable 12:00.UTC again. Noon UTC stays noon no matter where you run the code.Example 3 — Split a Date into Parts Use formatToParts when you need each piece labeled, for example to style the month differently.
const d = new Date(Date.UTC(2024, 5, 15, 12, 0, 0));
const fmt = new Intl.DateTimeFormat("en-US", {
timeZone: "UTC",
year: "numeric",
month: "long",
day: "numeric"
});
const parts = fmt.formatToParts(d)
.filter(function (p) { return p.type !== "literal"; })
.map(function (p) { return p.type + ":" + p.value; });
console.log(parts.join("|")); month:June|day:15|year:2024 How It Works Parts array. Each item has a type such as month, day or year.Skip literals. Separators like commas are type literal; this example drops them.Join for display. Printing type:value pairs makes a clear, stable console line.Compatibility
Browser & Runtime Support Intl.DateTimeFormat is part of the original ES2015 Intl API (or arrived soon after and is now everywhere). Every current browser and Node.js has it.
✓ ES2015 · Widely supported
Intl.DateTimeFormat Supported in Chrome 24+, Edge 12+, Firefox 29+, Safari 10+, Opera 15+ and Node.js 0.12+. Internet Explorer had partial Intl support only.
Google Chrome 24+ · Desktop & Mobile
Full support
Microsoft Edge 12+ · Chromium based
Full support
Mozilla Firefox 29+ · Desktop & Mobile
Full support
Apple Safari 10+ · macOS & iOS
Full support
Opera 15+ · Chromium based
Full support
Samsung Internet Recent versions · Android
Supported
Android WebView 24+ · Chromium based
Supported
Node.js 0.12+ · Server runtime
Supported
Deno Supported · JavaScript runtime
Supported
Bun Supported · JavaScript runtime
Supported
Internet Explorer No native support
Not supported Intl.DateTimeFormat Excellent
Bottom line: Safe to use in every current browser and in Node.js. No feature-detect needed for modern code.
Frequently Asked Questions What does Intl.DateTimeFormat do? It formats a Date into a locale-aware string, with options for which fields to show and which time zone to use.
Why use timeZone UTC in examples? So the printed calendar day and clock time stay the same on every machine, independent of the local zone.
What is formatToParts? It returns an array of pieces with type and value, so you can style or rearrange parts without parsing the finished string.
Are months zero-based in Date.UTC? Yes. Date.UTC(2024, 5, 15) is 15 June 2024, because month 5 means June.
Can I pass a locale list? Yes. Pass an array of tags; the engine picks the best available locale from the list.
About the author Developer, cloud engineer, and technical writer
I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.
14 people found this page helpful
Helpful Share Copy link Suggestion