JavaScript Date toLocaleTimeString() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Date

Definition

Date.prototype.toLocaleTimeString() returns a language-sensitive string for the time portion of a Date (local timezone by default). With Intl support, it delegates to Intl.DateTimeFormat.

Remember
date.toLocaleTimeString()
date.toLocaleTimeString(locales)
date.toLocaleTimeString(locales, options)

→ "3:00:00 AM"      (en-US + timeZone: "UTC")
→ "03:00:00"        (en-GB + timeZone: "UTC")
→ "Invalid Date"    (if the Date is invalid)

toLocaleDateString()  → date only
toLocaleString()      → date + time
toTimeString()        → fixed engine time + offset text

Syntax

Call date.toLocaleTimeString. Start with this line.

JavaScript
date.toLocaleTimeString(locales?, options?)
CallWhat it does
date.toLocaleTimeString(locales?, options?)Primary signature.
date.toLocaleTimeString(...)Call with the arguments your case needs.

Built into JavaScript. Call toLocaleTimeString(...) on a Date instance — no import required.

Library declarations
JavaScript
date.toLocaleTimeString(locales?, options?)

Parameters

ParameterDescription
localesOptional. BCP 47 tag or array of tags
optionsOptional. timeStyle, hour12, timeZone, hour/minute/second, …

Return Value

Return ValueDescription
*The value returned by date.toLocaleTimeString().

JavaScript Examples

Example 1 — Same Instant in Two Locales (UTC)

Pin timeZone: "UTC" so the clock stays predictable across machines.

JavaScript
const event = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
const utc = { timeZone: "UTC" };

console.log(event.toLocaleTimeString("en-US", utc)); // "3:00:00 AM"
console.log(event.toLocaleTimeString("en-GB", utc)); // "03:00:00"
Try It Yourself

How It Works

  1. Build a UTC instant. Date.UTC(..., 3, 0, 0) is 03:00 UTC.
  2. Fix the zone. timeZone: "UTC" ignores the machine’s local offset.
  3. Format for the US. 12-hour clock with AM/PM → "3:00:00 AM".
  4. Format for Britain. 24-hour clock → "03:00:00".

Example 2 — Force 24-Hour Time with hour12: false

Override the US default so the clock prints without AM/PM.

JavaScript
const event = new Date(Date.UTC(2012, 11, 20, 15, 30, 0));

console.log(event.toLocaleTimeString("en-US", {
  hour12: false,
  timeZone: "UTC"
}));
// "15:30:00"
Try It Yourself

How It Works

  1. Pick an afternoon UTC time. 15:30 UTC is clear in 24-hour form.
  2. Keep en-US locale. Without options it would prefer AM/PM.
  3. Set hour12: false. Forces a 24-hour clock for that locale.
  4. Stay in UTC. The printed hour matches the UTC fields you set.

Example 3 — Guard Against Invalid Dates

Check getTime() before formatting user input.

JavaScript
const bad = new Date("not-a-date");

if (Number.isNaN(bad.getTime())) {
  console.log("Bad input");
} else {
  console.log(bad.toLocaleTimeString("en-US"));
}
// without the guard: "Invalid Date"
Try It Yourself

How It Works

  1. Create an invalid Date. Bad input yields a NaN time value.
  2. Detect early. Number.isNaN(bad.getTime()) is true.
  3. Show a clear message. Prefer "Bad input" over a confusing label.
  4. Without a guard. toLocaleTimeString() returns the string "Invalid Date".

Browser & Runtime Support

Date.prototype.toLocaleTimeString() itself dates to ES1. The locales and options parameters require the Intl API (widely available in modern browsers and Node.js).

✓ Baseline · Intl

Date.prototype.toLocaleTimeString()

Basic method: everywhere Date exists. Locales/options: Chrome, Firefox, Safari, Edge, and modern Node.js with full Intl data.

98% Modern Intl support
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
Date.toLocaleTimeString() Excellent

Bottom line: Safe for modern UI. Feature-detect with typeof Intl !== "undefined" && Intl.DateTimeFormat if you must support very old engines. See also the MDN toLocaleTimeString() reference.

Frequently Asked Questions

A language-sensitive string for the time portion only (for example "3:00:00 AM" in en-US with timeZone UTC, or "03:00:00" in en-GB). The calendar date is not included.
toLocaleTimeString() formats clock time only. toLocaleString() includes both date and time. Use toLocaleDateString() for the calendar date alone.
Pass hour12: false in options, or use a locale that defaults to 24-hour time (for example en-GB).
Yes. Set timeZone in options — for example { timeZone: "UTC" } or { timeZone: "Europe/London" }.
No. Engines may insert non-breaking spaces or bidirectional marks. Treat the output as display text; use toISOString() or getters for logic.
It returns the string "Invalid Date". Validate with Number.isNaN(date.getTime()) before showing labels in UI.

Next: toString()

Learn the default Date string that includes local date, time, and timezone offset.

toString() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

11 people found this page helpful