Encodera

Thanks for reading!

Donate to the site — we work hard for you.

How to show a date in another time zone

Short answer

A date object stores one moment. The timeZone option shows that moment as the clock in a given city:

const moment = new Date(Date.UTC(2025, 5, 1, 12, 0));
 
console.log(moment.toLocaleString('en-GB', { timeZone: 'Asia/Tokyo' }));

Output:

01/06/2025, 21:00:00

Several cities

Intl.DateTimeFormat is convenient for repeated formatting:

const moment = new Date(Date.UTC(2025, 5, 1, 12, 0));
const cities = ['Europe/London', 'Europe/Berlin', 'America/New_York'];
 
for (const timeZone of cities) {
  const time = new Intl.DateTimeFormat('en-GB', { timeZone, hour: '2-digit', minute: '2-digit' }).format(moment);
  console.log(timeZone, time);
}

Output:

Europe/London 13:00
Europe/Berlin 14:00
America/New_York 08:00

The user's time zone

resolvedOptions() tells which time zone the browser uses:

const zone = Intl.DateTimeFormat().resolvedOptions().timeZone;
 
console.log(typeof zone);

Output:

string

Common mistake

Adding hours to the date by hand to change the time zone breaks during daylight saving time changes. Format with timeZone and keep the moment itself unchanged.

const moment = new Date(Date.UTC(2025, 2, 30, 12, 0));
 
console.log(moment.toLocaleString('en-GB', { timeZone: 'Europe/Berlin' }));

Output:

30/03/2025, 14:00:00

Functions used in this recipe

Thanks for reading!

Donate to the site — we work hard for you.