English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

The JavaScript toLocaleTimeString() Method

 JavaScript Date Object

toLocaleTimeString()Method returns a string representing the time part of the date object, which is associated with the system's locale setting (locality sensitive).

Syntax:

date.toLocaleTimeString()
var d = new Date();
var str = d.toLocaleTimeString();
document.getElementById('result').innerHTML = str;
Test See‹/›

Browser Compatibility

All browsers fully support the toLocaleTimeString() method:

Method
toLocaleTimeString()YesYesYesYesYes

Technical Details

Return Value:A string, represented according to the conventions of the operating system's locale setting for the 'time' part
JavaScript Version:ECMAScript 1

 JavaScript Date Object