toLocaleTimeString
Summary
Returns a time as a string value appropriate to the host environment’s current locale.
Syntax
toLocaleTimeString()
Examples
var nowdate = new Date();
alert(nowdate.toLocaleTimeString());
// output: "11:34:06 AM"
Remarks
String that contains a time, in the current time zone, in a human readable format. The date is in the default format of the host environment’s current locale.
Usage
The return value of toLocaleTimeString cannot be relied upon in scripting, as it will vary from computer to computer. The toLocaleTimeString method should only be used to format display - never as part of a computation.
See also
Other articles
- toString Method (Date)
- toDateString Method (Date)
- toGMTString Method (Date)
- toISOString Method (Date)
- toLocaleString Method (Date)
- toLocaleDateString Method (Date)
- toTimeString Method (Date)
- toUTCString Method (Date)
External resources
- toLocaleTimeString(), by Mozilla Developer Network
- toLocaleTimeString(), by Microsoft Developer Network
Specification
Date.prototype.toLocaleTimeString()
ECMAScript® Language Specification Standard ECMA-262 5.1 Edition / June 2011
Attributions
Microsoft Developer Network: Article