JavaScript toLocaleDateString()Method
Example
Convert the date portion of a Date object to a string according to local time:
var d=new Date();
var n=d.toLocaleDateString();
var n=d.toLocaleDateString();
nOutput:
Try it Yourself »
Definition and Usage
The toLocaleDateString() method converts the date portion of a Date object into a string according to 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 rules. |
Technical Details
| JavaScript Version: | 1.0 |
|---|
Other Extensions
JavaScript Date Object