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.

toLocaleDateString

Summary

Returns a date as a string value appropriate to the host environment’s current locale.

Syntax

toLocaleDateString()

Return Value

String that contains a date, in the current time zone, in a human readable format. The date is in the default format of the host environment’s current locale.

Examples

var nowdate = new Date();
alert(nowdate.toLocaleDateString());
// output: "Tuesday, November 04, 2014"

Usage

 The return value of toLocaleDateString cannot be relied upon in scripting, as it will vary from computer to computer. The toLocaleDateString method should only be used to format display - never as part of a computation.

See also

Other articles

External resources

Specification

Date.prototype.toLocaleDateString()

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

Attributions

  • Microsoft Developer Network: Article