toLocaleDateString (JavaScript)

Gets a string representing the local date using the format conventions of the underlying operating system.

Defined in

Date (Standard - JavaScript)

Syntax

toLocaleDateString() : string
Return value Description
string The string representation of the date.

Examples

(1) This computed label displays the current date.
var date = new Date();
date.toLocaleDateString()
// Nov 26, 2006

(2) This computed label displays the base date (where the time zone is -5).

var date = new Date(0);
date.toLocaleDateString()
// Dec 31, 1969