JavaScript Date toTimeString() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Date

Definition

Date.prototype.toTimeString() returns a string for the time portion of a date in the local timezone — typically HH:mm:ss GMT±xxxx (TZ). It is read-only and does not include the calendar date.

Remember
date.toTimeString()

→ "23:15:30 GMT+0530 (India Standard Time)"  (example)
→ "Invalid Date"                             (if invalid)

Format (local):
  HH:mm:ss GMT±xxxx (TZ)

toDateString()       → date only
toString()           → date + time
toLocaleTimeString() → locale-friendly time

Syntax

Call date.toTimeString. Start with this line.

JavaScript
date.toTimeString()
CallWhat it does
date.toTimeString()Primary signature.
date.toTimeString(...)Call with the arguments your case needs.

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

Library declarations
JavaScript
date.toTimeString()

Parameters

This method has no parameters beyond those shown in the signature.

Return Value

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

JavaScript Examples

Example 1 — Format Local Clock Time

Call toTimeString() on a fixed local date-time.

JavaScript
const event = new Date(1975, 7, 19, 23, 15, 30); // Aug 19, 1975

console.log(event.toTimeString());
// e.g. "23:15:30 GMT+0530 (India Standard Time)"
Try It Yourself

How It Works

  1. Build a local date. Month index 7 is August; time is 23:15:30.
  2. Format the time. toTimeString() reads local hours, minutes, and seconds.
  3. Append offset. The engine adds GMT±xxxx and usually a timezone name.
  4. No date. The calendar day is omitted — that is what makes it “time string.”

Example 2 — toTimeString() vs Date / Full String

See how the three classic formatters split date and time.

JavaScript
const d = new Date(2026, 2, 1, 14, 5, 9);

console.log(d.toTimeString()); // time + offset
console.log(d.toDateString()); // date only
console.log(d.toString());     // date + time
Try It Yourself

How It Works

  1. Same instant. All three methods read the same Date.
  2. Time only. toTimeString() drops the weekday and calendar fields.
  3. Date only. toDateString() drops the clock fields.
  4. Both. toString() joins them into one English engine string.

Example 3 — Invalid Date Handling

Bad parses return the string "Invalid Date" (no exception).

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

console.log(bad.toTimeString()); // "Invalid Date"
console.log(Number.isNaN(bad.getTime())); // true
Try It Yourself

How It Works

  1. Create an invalid Date. Unparseable strings make getTime() return NaN.
  2. Format anyway. toTimeString() returns the literal "Invalid Date".
  3. No throw. Unlike toISOString(), this method does not raise RangeError.
  4. Validate first. Check Number.isNaN(date.getTime()) if you need a custom message.

Browser & Runtime Support

Date.prototype.toTimeString() has been in JavaScript since ES1. It is Baseline and works in every modern browser and Node.js — no polyfill needed.

✓ Baseline · ES1

Date.prototype.toTimeString()

Supported everywhere Date exists: Chrome, Firefox, Safari, Edge, Internet Explorer, and all Node.js versions.

99% Universal API
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.toTimeString() Excellent

Bottom line: Safe to use in any environment. Remember it is local English engine text — not a locale UI API. See also the MDN toTimeString() reference.

Frequently Asked Questions

A string with the local clock time and timezone offset — for example "23:15:30 GMT+0530 (India Standard Time)". The calendar date is not included. Exact offset and name depend on the runtime timezone.
No. It formats only hours, minutes, seconds, GMT offset, and usually a timezone name. Use toDateString() for the calendar portion or toString() for both.
toTimeString() uses a fixed English engine format with GMT±xxxx text. toLocaleTimeString() follows Intl locale rules and accepts options like hour12 and timeStyle — better for user-facing UI.
Usually not for end-user labels. Prefer toLocaleTimeString() for locale-aware display. toTimeString() is best for debugging and quick console output.
No. It is read-only — it returns a new string and leaves the Date unchanged.
It returns the string "Invalid Date" (it does not throw). Validate with Number.isNaN(date.getTime()) before formatting if you need custom handling.

Next: toUTCString()

Learn how to format a Date as an English UTC date-time string.

toUTCString() 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