formatting

Date.prototype.toLocaleTimeString

Returns the time portion formatted for a given locale and options, without the date. Same locale/options rules as toLocaleDateString.

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

Parameters

Parameter Purpose
locales BCP 47 tag(s)
timeStyle 'full' | 'long' | 'medium' | 'short'
hour12 true = 12-hour clock; false = 24-hour
timeZone IANA zone name

Examples

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

US default 12h

console.log(new Date('2026-07-19T15:30:00Z').toLocaleTimeString('en-GB', {timeZone:'UTC', hour12:false})); // '15:30:00'

UK 24h

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

short style

Gotcha

Without an explicit timeZone option, output depends on the host machine's zone - CI and browsers can disagree. Pass timeZone for reproducible output.

Related

← All JS Date methods · Math methods · Cron syntax