JavaScript Reference ยท Date and Intl
Date.prototype.toLocaleTimeString()
Reference for JavaScript toLocaleTimeString(): format the time part of a Date by locale with 12 or 24 hour clocks, timeStyle, timeZone and zone names.
toLocaleTimeString() returns the time part of a Date as a string formatted for a language and region. A clock reads 9:30:00 AM in the United States, 09:30:00 in Germany and 9:30:00 in Japan. The method also converts the instant into a time zone of your choice.
It accepts a locale and an options object, just like toLocaleDateString(), and uses Intl.DateTimeFormat internally.
const d = new Date(Date.UTC(2026, 2, 15, 9, 30)); d.toLocaleTimeString("de-DE", { timeZone: "UTC" }); // "09:30:00"
Try it
Press Run (or Ctrl + Enter) to see the console output here.
No output.
Press Run (or Ctrl + Enter) to see the console output here.
No output.
Syntax
date.toLocaleTimeString() date.toLocaleTimeString(locales) date.toLocaleTimeString(locales, options)
| Name | Description |
|---|---|
locales |
A BCP 47 language tag such as "en-US", or an array of tags. Defaults to the user's locale. |
options |
Intl.DateTimeFormat options. The common ones: hour, minute, second ("numeric" or "2-digit"), fractionalSecondDigits (1 to 3), hour12 (boolean), hourCycle ("h11", "h12", "h23", "h24"), timeStyle, timeZone and timeZoneName. |
Return value: the formatted time as a string, or "Invalid Date" for an invalid date.
Exceptions: a RangeError for an invalid locale tag or option value, and a TypeError if you ask for dateStyle, or mix timeStyle with individual fields.
Usage notes
- The default shows hours, minutes and seconds. Name only
hourandminuteto drop the seconds. - 12 or 24 hours: the locale decides, and
hour12: true/falseoverrides it.hour12takes priority overhourCycle. - Time zone: without
timeZoneyou get the user's local zone. Use an IANA name such as"Europe/Berlin", which also handles daylight saving time for that date. - Spacing varies. Between the time and
AM/PM, newer engines use a narrow no-break space instead of a normal space, so never compare these strings with plain-space literals. - Output depends on the engine's locale data. Use it for display only; never parse the result.
- Reuse a formatter with
Intl.DateTimeFormatwhen formatting lots of values, such as a list of timestamps. - For date and time together, call
toLocaleString()or useIntl.DateTimeFormatwith both parts.
Browser support
toLocaleTimeString() works in every modern browser and runtime. Support for timeStyle and fractionalSecondDigits is newer than the classic options, so check a compatibility table if you need old browsers.