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





All major browsers support the toLocaleString() method
Syntax
Date
.toLocaleString()
Return Value
| Type | Description |
|---|---|
| String | Date and time are output as a string. |
Technical Details
| JavaScript version: | 1.0 |
|---|
JavaScript Date object