This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

toString

Summary

Returns a human readbale string representation of a date.

Syntax

toString()

Return Value

String that contains the date, time and timezone in a human readable format.

Examples

var now = new Date();
console.log(now.toString());
// outputs: "Wed Oct 08 2014 13:46:37 GMT+0200 (CEST)"

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 Wed Oct 08 2014 13:46:37 GMT+0200 (CEST).

toString() 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).

See also

Other articles

External resources

Specification

Date.prototype.toString()

ECMAScript® Language Specification Standard ECMA-262 5.1 Edition / June 2011

Attributions

  • Microsoft Developer Network: Article