Temporal.ZonedDateTime.prototype.withTimeZone()

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

The withTimeZone() method of Temporal.ZonedDateTime instances returns a new Temporal.ZonedDateTime object representing the same instant as this date-time but in the new time zone. Because all Temporal objects are designed to be immutable, this method essentially functions as the setter for the date-time's timeZoneId property.

To replace the date-time component properties, use the with() method. To replace its calendar, use the withCalendar() method.

Syntax

js
withTimeZone(timeZone)

Parameters

timeZone

Either a string or a Temporal.ZonedDateTime instance representing the time zone to use. If a Temporal.ZonedDateTime instance, its time zone is used. If a string, it can be a named time zone identifier, an offset time zone identifier, or a date-time string containing a time zone identifier or an offset (see time zones and offsets for more information).

Return value

A new Temporal.ZonedDateTime object representing the same instant as this date-time but in the new time zone.

Exceptions

TypeError

Thrown if timeZone is not a string or a Temporal.ZonedDateTime instance.

RangeError

Thrown if the time zone name is invalid.

Examples

Using withTimeZone()

js
const meetingTime = Temporal.ZonedDateTime.from(
  "2021-08-01T12:00[America/New_York]",
);
const meetingTimeInParis = meetingTime.withTimeZone("Europe/Paris");
console.log(meetingTimeInParis.toString()); // 2021-08-01T18:00:00+02:00[Europe/Paris]

Replacing the time zone while keeping the same wall-clock time

In the rare case where you want to keep the wall-clock time the same but change the time zone (and result in a different instant), convert it to a Temporal.PlainDateTime first:

js
const meetingTime = Temporal.ZonedDateTime.from(
  "2021-08-01T12:00[America/New_York]",
);
const meetingTimeInParis = meetingTime
  .toPlainDateTime()
  .toZonedDateTime("Europe/Paris");
console.log(meetingTimeInParis.toString()); // 2021-08-01T12:00:00+02:00[Europe/Paris]

Specifications

Specification
Temporal
# sec-temporal.zoneddatetime.prototype.withtimezone

Browser compatibility

desktop mobile server
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Bun
Deno
Node.js
withTimeZone
Chrome – Full support
Chrome 144 (Release date: 2026-01-13)
footnote Full support
Edge – Full support
Edge 144 (Release date: 2026-01-21)
footnote Full support
Firefox – Full support
Firefox 139 (Release date: 2025-05-27)
footnote Full support
Opera – Full support
Opera 128 (Release date: 2026-02-26)
footnote Full support
Safari – No support
Safari
footnote
footnote See bug 223166
Chrome Android – Full support
Chrome Android 144 (Release date: 2026-01-13)
footnote Full support
Firefox for Android – Full support
Firefox for Android 139 (Release date: 2025-05-27)
footnote Full support
Opera Android – Full support
Opera Android 95 (Release date: 2026-02-11)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote
footnote See bug 223166
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – Full support
WebView Android 144 (Release date: 2026-01-13)
footnote Full support
WebView on iOS – No support
WebView on iOS
footnote
footnote See bug 223166
Bun – No support
Bun
footnote No support
Deno – Full support
Deno 2.7 (Release date: 2026-02-25)
footnote Full support
Node.js – No support
Node.js
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
See implementation notes.

See also