toLocaleTimeString (JavaScript)

Gets a string representing the local time using the format conventions of the underlying operating system.

Defined in

Date (Standard - JavaScript)

Syntax

toLocaleTimeString() : 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.toLocaleTimeString()
// 11:25:36

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

var date = new Date(0);
date.toLocaleTimeString()
// 01:00:00