JavaScript toLocaleDateString() Method
Example
Converts the date portion of a Date object to a string based on local time:
var d=new Date();
var n=d.toLocaleDateString();
n Output result:
Try it »
Definition and Usage
The toLocaleDateString() method converts the date portion of a Date object to a string based on local time and returns the result.
Browser support





All major browsers support the toLocaleDateString() method
Syntax
Date
.toLocaleDateString()
Return Value
| Type | Description |
|---|---|
| String | A string representation of the date portion of a Date object, expressed in the local time zone and formatted according to local conventions. |
Technical Details
| JavaScript version: | 1.0 |
|---|
JavaScript Date object