Date.prototype.toTimeString() returns the time portion of a Date as a string interpreted in the local time zone. The text normally includes local hours, minutes, seconds, the numeric UTC offset and a time-zone description.
Syntax:
date.toTimeString();
Example:
const date = new Date(2026, 8, 10, 18, 45, 30);
console.log(date.toTimeString());
The return value is a string. Unlike toString(), it omits the calendar-date portion.
const date = new Date();
const text = date.toTimeString();
console.log(text);
console.log(typeof text); // "string"
The same timestamp can produce different toTimeString() values in different local time zones because the method formats the Date using the host’s local zone.
toTimeString() gives a general local time representation with no formatting arguments. toLocaleTimeString() is better when the time should follow a locale or custom display options.
const date = new Date();
console.log(date.toTimeString());
console.log(date.toLocaleTimeString("en-IN", { hour: "2-digit", minute: "2-digit" }));
For a UTC text representation, toUTCString() includes the full UTC date and time. For standardized machine output, toISOString() is often more useful.
const date = new Date();
console.log(date.toTimeString()); // local
console.log(date.toUTCString()); // UTC date + time
console.log(date.toISOString()); // standardized UTC
If you need to calculate with hours, minutes or seconds, use Date getters instead of parsing toTimeString().
const date = new Date();
const hours = date.getHours();
const minutes = date.getMinutes();
const seconds = date.getSeconds();
console.log(hours, minutes, seconds);
Do not save or transmit this display string as your time data. Keep the Date/timestamp or a defined ISO representation and format it only for presentation.
Next: UTC Date Methods Date Reference
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.