Intl.DateTimeFormat, DateTimeFormat.prototype.format
new Intl.DateTimeFormat(locales, options)
formatter.format(date)Format a Date in an explicit locale and time zone. Pass timeZone; do not rely on the host default.
| Parameter | Description |
|---|---|
locales | A BCP 47 language tag such as en-US, or an array of tags. |
options | Must include timeZone for a stable clock reading in these examples. The example also sets year, month, day, hour, minute, second, and hourCycle. |
date | A Date instant. The example builds it with Date.UTC so the instant is explicit. |
Returns: format returns a string. The text is language-sensitive and ICU-dependent.
Throws
RangeError— Thrown when a locale or option is invalid, for example an unknown timeZone.
- Output measured in Node.js 22.23.3, ICU 78.3, on this host. It is not a claim about every browser or ICU version.
- The Date page documents UTC accessors that are not locale-sensitive. Use those when you need a stable ISO string rather than a formatted date.
const instant = new Date(Date.UTC(2026, 0, 1, 15, 4, 5));
const options = {
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
hourCycle: "h23",
};
console.log(new Intl.DateTimeFormat("en-US", { ...options, timeZone: "UTC" }).format(instant));
console.log(new Intl.DateTimeFormat("en-US", { ...options, timeZone: "Asia/Shanghai" }).format(instant));Expected output
01/01/2026, 15:04:05
01/01/2026, 23:04:05Related: Date UTC accessors