JavaScript toTimeString()Method

Date 对象参考手册JavaScript Date Object

Examples

Converts the time portion of a Date object to a string:

var d=new Date();
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

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the toTimeString() method


Syntax

Date.toTimeString()


Return Value

Type Description
String Output the time as a string


Date 对象参考手册JavaScript Date Object

Other Extensions