JavaScript toTimeString()Method
Examples
Converts the time portion of a Date object to a string:
var d=new Date();
var n=d.toTimeString();
var n=d.toTimeString();
nOutput:
Try it Yourself »
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 | Output the time as a string |
Other Extensions
JavaScript Date Object