Latest web development tutorials

JavaScript toLocaleTimeString () method

Date Object Reference JavaScript Date Object

Examples

According to the local time of the time part of a Date object converted to a string:

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

n output:


try it"

Definition and Usage

toLocaleTimeString () method can be based on local time, the time part of a Date object converted to a string and returns the result.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support toLocaleTimeString () method


grammar

Date.toLocaleTimeString()

return value

Type 描述
String date Object 的时间部分的字符串表示,以本地时间区表示,并根据本地规则格式化。

technical details

JavaScript version: 1.0


Date Object Reference JavaScript Date Object