JavaScript Date toTimeString() method returns a “string representing the time portion of this date interpreted in the local timezone.”
Syntax
dateObj.toTimeString()
Parameters
This method does not accept any parameter.
Return value
It returns the time portion of the given date object in English.
Example 1: Basic Usage of Date toTimeString()
let today = new Date();
console.log(today.toTimeString());
Output
11:51:02 GMT+0530 (India Standard Time)
Example 2: Using toTimeString() with a predefined date
let specificDate = new Date('2023-08-16T12:34:56Z');
console.log(specificDate.toTimeString());
Output
18:04:56 GMT+0530 (India Standard Time)
Example 3: Extracting hours, minutes, and seconds
let now = new Date();
let timeString = now.toTimeString();
let timeParts = timeString.split(' ')[0];
let [hours, minutes, seconds] = timeParts.split(':');
console.log("Hours:", hours, "Minutes:", minutes, "Seconds:", seconds);
Output
Hours: 11 Minutes: 54 Seconds: 00
Browser Compatibility
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |
That’s it!
Related posts
JavaScript Date toLocaleDateString()

Krunal Lathiya is a seasoned Computer Science expert with over eight years in the tech industry. He boasts deep knowledge in Data Science and Machine Learning. Versed in Python, JavaScript, PHP, R, and Golang. Skilled in frameworks like Angular and React and platforms such as Node.js. His expertise spans both front-end and back-end development. His proficiency in the Python language stands as a testament to his versatility and commitment to the craft.