JavaScript toTimeString() Method
Example
Converts the time portion of a Date object to a string:
var d=new Date();
var n=d.toTimeString();
n Output result:
Try it »
Definition and Usage
The toTimeString() method converts the time portion of a Date object to a string and returns the result.
Browser support





All major browsers support the toTimeString() method
Syntax
Date
.toTimeString()
Return Value
| Type | Description |
|---|---|
| String | Time output as a string |
JavaScript Date object