JavaScript Date toLocaleString()
JavaScript Date toLocaleString()
The toLocaleString() method is used to return a Date object as a string by using locale settings. In the end, it all depends on the default language set locally on your computer.
Syntax:-
Its syntax is:- Date.toLocaleString(locales, options)
Return:-
Its return is:- string containing both date and time
Further Explanation:-
Parameter | Description |
locales | Optional.The language-specific format to use like en-CA, en-GB, en-US, en-AU, etc. |
options | Optional. An object with formatting options like timeStyle, timeZoneName, timeZone, dateStyle, etc. |