toLocaleTimeString()
displays the date's hours, minutes, and seconds.
toLocaleTimeString() |
Yes | Yes | Yes | Yes | Yes |
dateObject.toLocaleTimeString();
A string representing the time as a string.
var aDate = new Date(Date.UTC(2021, 5, 4, 12, 21, 55));
console.log(aDate.toLocaleTimeString());
The code above generates the following result.