Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
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.