Timezones
JavaScript dates are stored in UTC internally but displayed in the local timezone. Use Intl.DateTimeFormat with a timeZone option to display in any timezone.
JavaScript dates are stored in UTC internally but displayed in the local timezone. Use Intl.DateTimeFormat with a timeZone option to display in any timezone.
// Display in a specific timezone
const d = new Date("2024-06-15T10:00:00Z"); // UTC
new Intl.DateTimeFormat("en-US", {
timeZone: "America/New_York",
dateStyle: "full",
timeStyle: "long",
}).format(d);
// "Saturday, June 15, 2024 at 6:00:00 AM EDT"
new Intl.DateTimeFormat("en-US", {
timeZone: "Asia/Tokyo",
timeStyle: "short",
}).format(d);
// "7:00 PM" (next day in Tokyo)
Store all dates in UTC (ISO strings) and convert to local timezone only at display time.
More in JavaScript