toTimeString (JavaScript)

Gets a string representing the local time.

Defined in

Date (Standard - JavaScript)

Syntax

toTimeString() : string
Return value Description
string The string representation of the time.

Examples

(1) This computed label displays the current time.
var date = new Date();
date.toTimeString()
// 11:25:36 AM

(2) This computed label displays the base time (where the time zone is -5).

var date = new Date(0);
date.toTimeString()
// 7:00:00 PM