Time Zones with Intl
A date is one moment in time; what the clock on the wall says depends on where you are. Intl.DateTimeFormat turns a moment into text for a language and a time zone. Time zones have names like "Africa/Accra", "America/New_York" and "Asia/Tokyo"; leave timeZone out and it uses the device's own zone.
Ask for hour, minute and second as "2-digit", and set hourCycle: "h23" so the hours run 00 to 23 rather than adding AM and PM.
The same formatter writes dates in words: { weekday: "long", month: "long", day: "numeric", year: "numeric" } gives Monday, October 12, 2026. And formatToParts hands back the result in labeled pieces; the piece with type "timeZoneName" is the zone's short name, such as EST. Some zones have no letters in English and come back as GMT+9.
Mark this lesson complete
Signed in, your progress follows you to every device.