Course contentsShow
← Web Development
Lesson 2770 of 2,98249. Dates, Times, and Numbers on the WebFree lesson

Formatting Time Zones with Intl

Displaying dates in specific time zones using the timeZone option and handling zone names.

Formatting Time Zones with Intl

You'll learn how to display dates in any time zone and customize how the zone name appears using Intl.DateTimeFormat.

Core Concept

The timeZone option in Intl.DateTimeFormat lets you display any date in any time zone—without converting the underlying Date object. Think of it like viewing the same moment through different local clocks around the world. The timeZoneName option controls how that zone is labeled in your formatted string.

Displaying Dates in Specific Time Zones

The timeZone option accepts IANA timezone identifiers:

const date = new Date('2024-01-15T12:00:00Z');

const tokyoFormatter = new Intl.DateTimeFormat('en-US', {
  timeZone: 'Asia/Tokyo',
  dateStyle: 'medium',
  timeStyle: 'short'
});

console.log(tokyoFormatter.format(date));
// "Jan 15, 2024, 9:00 PM"

The same UTC moment displays as 9 PM in Tokyo (UTC+9).

Handling Zone Names

The timeZoneName option controls how the timezone identifier appears:

const formatter = new Intl.DateTimeFormat('en-US', {
  timeZone: 'America/New_York',
  timeZoneName: 'short'  // "EST" or "EDT"
});

const longFormatter = new Intl.DateTimeFormat('en-US', {
  timeZone: 'America/New_York',
  timeZoneName: 'long'  // "Eastern Standard Time"
});

Options include:

  • 'short': "PST", "EST"
  • 'long': "Pacific Standard Time"
  • 'shortOffset': "GMT-8"
  • 'longOffset': "GMT-08:00"
  • 'shortGeneric': "PT" (Pacific Time)
  • 'longGeneric': "Pacific Time"

The "generic" options don't distinguish between standard and daylight time, while "short" and "long" do.

Key Takeaway: Use the timeZone option to display dates in any zone, and timeZoneName to control whether you show abbreviations, full names, or offsets—giving users the context they need to understand when something happened or will happen.