JavaScript toLocaleString()Method
Examples
Convert the Date object to a string according to local time:
var d=new Date();
var n=d.toLocaleString();
var n=d.toLocaleString();
nOutput:
Try it Yourself »
Definition and Usage
The toLocaleString() method converts a Date object to a string according to local time and returns the result.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the toLocaleString() method.
Syntax
Date.toLocaleString()
Return Value
| Type | Description |
|---|---|
| String | The date and time are output as a string. |
Technical Details
| JavaScript Version: | 1.0 |
|---|
Other Extensions
JavaScript Date Object