JavaScript Date toTimeString() Method

Definition and usage

toTimeString() This method converts the time part of the Date object to a string.

Example

Convert the time part of the Date object to a string:

var d = new Date();
var n = d.toTimeString();

Try it yourself

Syntax

Date.toTimeString()

Parameters

No parameters.

Technical details

Return value: A string representing the time in string format.

Browser support

Method Chrome IE Firefox Safari Opera
toTimeString() Support Support Support Support Support

Related Pages

Tutorial:JavaScript Date

Tutorial:JavaScript Date Format

Tutorial:JavaScript String