Javascript Reference - JavaScript toLocaleTimeString() Method








toLocaleTimeString() displays the date's hours, minutes, and seconds.

Browser Support

toLocaleTimeString() Yes Yes Yes Yes Yes

Syntax

dateObject.toLocaleTimeString();

Return Value

A string representing the time as a string.

Example


var aDate = new Date(Date.UTC(2021, 5, 4, 12, 21, 55)); 
console.log(aDate.toLocaleTimeString()); 

The code above generates the following result.