formatting

Date.prototype.toLocaleString

Returns date and time together formatted for a given locale. Accepts the union of date and time options from Intl.DateTimeFormat.

date.toLocaleString([locales[, options]])

Parameters

Parameter Purpose
locales BCP 47 tag(s)
dateStyle + timeStyle shorthand for common combinations
timeZone IANA zone; strongly recommended
timeZoneName 'short' | 'long' | 'shortOffset' | 'longOffset'

Examples

console.log(new Date('2026-07-19T15:30:00Z').toLocaleString('en-US', {timeZone:'UTC'})); // '7/19/2026, 3:30:00 PM'

US default

console.log(new Date('2026-07-19T15:30:00Z').toLocaleString('en-US', {dateStyle:'medium', timeStyle:'short', timeZone:'America/New_York'})); // 'Jul 19, 2026, 11:30 AM'

styled + zone

console.log(new Date('2026-07-19T15:30:00Z').toLocaleString('en-US', {timeZone:'UTC', timeZoneName:'short'})); // '... UTC'

with zone label

Gotcha

You cannot mix dateStyle/timeStyle with individual fields like year/month - it throws TypeError. Choose one style or the other.

Related

← All JS Date methods · Math methods · Cron syntax