Returns the time component of a date as a human readable string.
SyntaxtoTimeString()
Return Value
String value containing the time, in the current time zone, in a convenient, human readable format, e.g. 15:20:46 GMT+0200 (CEST)
var date = new Date();
console.log(date.toTimeString());
console.log(now.toString());
Notes
According to the specification the contents of the String are implementation-dependent. That means that you cannot rely on the returned format being consistent across browsers. That said, all major browsers seem to agree on the format 15:20:46 GMT+0200 (CEST)
toTimeString() adds the code of the current timezone to the output. Because the output format is not specified, some browsers might replace (CEST)
(Central European Summer Time) with a fully localized text, e.g. the German (Mitteleuropäische Sommerzeit)
.
ECMAScript® Language Specification Standard ECMA-262 5.1 Edition / June 2011
AttributionsMicrosoft Developer Network: Article
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4