Javascript Reference - JavaScript toTimeString() Method








toTimeString() displays the date's hours, minutes, seconds, and time zone.

Browser Support

toTimeString() Yes Yes Yes Yes Yes

Syntax

dateObject.toTimeString();

Parameters

None.

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.toTimeString()); 

The code above generates the following result.