I think the function toLocaleDateString use the default local data on the device.

try this code to check the output:

// America/Los_Angeles for the US
// US English uses month-day-year order
console.log(date.toLocaleDateString('en-US'));
// → "12/19/2012"

// British English uses day-month-year order
console.log(date.toLocaleDateString('en-GB'));
// → "20/12/2012"

// Korean uses year-month-day order
console.log(date.toLocaleDateString('ko-KR'));
// → "2012. 12. 20."

// Arabic in most Arabic speaking countries uses real Arabic digits
console.log(date.toLocaleDateString('ar-EG'));
// → "٢٠‏/١٢‏/٢٠١٢"

// chinese
console.log(date.toLocaleDateString('zh-Hans-CN'));
// → "2012/12/20"
Answer from lostomato on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › toLocaleDateString
Date.prototype.toLocaleDateString() - JavaScript - MDN - Mozilla
The toLocaleDateString() method of Date instances returns a string with a language-sensitive representation of the date portion of this date in the local timezone. In implementations with Intl.DateTimeFormat API support, this method delegates to Intl.DateTimeFormat.
Top answer
1 of 11
92

I think the function toLocaleDateString use the default local data on the device.

try this code to check the output:

// America/Los_Angeles for the US
// US English uses month-day-year order
console.log(date.toLocaleDateString('en-US'));
// → "12/19/2012"

// British English uses day-month-year order
console.log(date.toLocaleDateString('en-GB'));
// → "20/12/2012"

// Korean uses year-month-day order
console.log(date.toLocaleDateString('ko-KR'));
// → "2012. 12. 20."

// Arabic in most Arabic speaking countries uses real Arabic digits
console.log(date.toLocaleDateString('ar-EG'));
// → "٢٠‏/١٢‏/٢٠١٢"

// chinese
console.log(date.toLocaleDateString('zh-Hans-CN'));
// → "2012/12/20"
2 of 11
76

JavaScript Date toLocaleString() This method formats a date into a string, using language specific format.

Examples :

Only date :

var n = new Date();
console.log("es-CL: " + n.toLocaleDateString("es-CL"));
// es-CL: 03-09-2021

Date with Time :

var n = new Date();
console.log("es-CL: " + n.toLocaleString("es-CL"));
// es-CL: 03-09-2021 17:56:58

List are here :

ar-SA: ٢٦‏/١‏/١٤٤٣ هـ في ٥:٥٦:٥٨ م
bn-BD: ৩/৯/২০২১ ৫:৫৬:৫৮ PM
bn-IN: ৩/৯/২০২১ ৫:৫৬:৫৮ PM
cs-CZ: 3. 9. 2021 17:56:58
da-DK: 3.9.2021 17.56.58
de-AT: 3.9.2021, 17:56:58
de-CH: 3.9.2021, 17:56:58
de-DE: 3.9.2021, 17:56:58
el-GR: 3/9/2021, 5:56:58 μ.μ.
en-AU: 03/09/2021, 5:56:58 pm
en-CA: 2021-09-03, 5:56:58 p.m.
en-GB: 03/09/2021, 17:56:58
en-IE: 3/9/2021, 17:56:58
en-IN: 3/9/2021, 5:56:58 pm
en-NZ: 3/09/2021, 5:56:58 pm
en-US: 9/3/2021, 5:56:58 PM
en-ZA: 2021/09/03, 17:56:58
es-AR: 3/9/2021 17:56:58
es-CL: 03-09-2021 17:56:58
es-CO: 3/9/2021, 5:56:58 p. m.
es-ES: 3/9/2021 17:56:58
es-MX: 3/9/2021 17:56:58
es-US: 3/9/2021 5:56:58 p. m.
fi-FI: 3.9.2021 klo 17.56.58
fr-BE: 03/09/2021, 17:56:58
fr-CA: 2021-09-03, 17 h 56 min 58 s
fr-CH: 03.09.2021, 17:56:58
fr-FR: 03/09/2021, 17:56:58
he-IL: 3.9.2021, 17:56:58
hi-IN: 3/9/2021, 5:56:58 pm
hu-HU: 2021. 09. 03. 17:56:58
id-ID: 3/9/2021 17.56.58
it-CH: 3/9/2021, 17:56:58
it-IT: 3/9/2021, 17:56:58
ja-JP: 2021/9/3 17:56:58
ko-KR: 2021. 9. 3. 오후 5:56:58
nl-BE: 3/9/2021 17:56:58
nl-NL: 3-9-2021 17:56:58
no-NO: 3.9.2021, 17:56:58
pl-PL: 3.09.2021, 17:56:58
pt-BR: 03/09/2021 17:56:58
pt-PT: 03/09/2021, 17:56:58
ro-RO: 03.09.2021, 17:56:58
ru-RU: 03.09.2021, 17:56:58
sk-SK: 3. 9. 2021, 17:56:58
sv-SE: 2021-09-03 17:56:58
ta-IN: 3/9/2021, பிற்பகல் 5:56:58
ta-LK: 3/9/2021, 17:56:58
th-TH: 3/9/2564 17:56:58
tr-TR: 03.09.2021 17:56:58
zh-CN: 2021/9/3 下午5:56:58
zh-HK: 3/9/2021 下午5:56:58
zh-TW: 2021/9/3 下午5:56:58
🌐
W3Schools
w3schools.com › jsref › jsref_tolocaledatestring.asp
JavaScript Date toLocaleDateString() Method
new Date() constructor getDate() getDay() getFullYear() getHours() getMilliseconds() getMinutes() getMonth() getSeconds() getTime() getTimezoneOffset() getUTCDate() getUTCDay() getUTCFullYear() getUTCHours() getUTCMilliseconds() getUTCMinutes() getUTCMonth() getUTCSeconds() now() parse() prototype setDate() setFullYear() setHours() setMilliseconds() setMinutes() setMonth() setSeconds() setTime() setUTCDate() setUTCFullYear() setUTCHours() setUTCMilliseconds() setUTCMinutes() setUTCMonth() setUTCSeconds() toDateString() toISOString() toJSON() toLocaleDateString() toLocaleTimeString() toLocaleString() toString() toTimeString() toUTCString() UTC() valueOf() JS Function
🌐
Codecademy
codecademy.com › docs › javascript › dates › .tolocaledatestring()
JavaScript | Dates | .toLocaleDateString() | Codecademy
June 2, 2023 - console.log(date.toLocaleDateString()); ... as the locale parameter, as shown in the example below: const date = new Date(2021, 11, 31); // US English - month/day/year ·...
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › toLocaleString
Date.prototype.toLocaleString() - JavaScript - MDN - Mozilla
October 30, 2025 - // An application may want to use UTC and make that visible options.timeZone = "UTC"; options.timeZoneName = "short"; console.log(date.toLocaleString("en-US", options)); // Example output: "Thursday, December 20, 2012 at UTC" // Sometimes even the US needs 24-hour time console.log(date.toL...
🌐
Reality Ripple
udn.realityripple.com › docs › Web › JavaScript › Reference › Global_Objects › Date › toLocaleDateString
Date.prototype.toLocaleDateString() - JavaScript
function toLocaleDateStringSupportsLocales() { try { new Date().toLocaleDateString('i'); } catch (e) { return e.name === 'RangeError'; } return false; } This example shows some of the variations in localized date formats.
🌐
TutorialsPoint
tutorialspoint.com › javascript › date_tolocaledatestring.htm
JavaScript Date toLocaleDateString() Method
<html> <body> <script> const today = new Date(); const dateString = today.toLocaleDateString(); document.write(dateString); </script> </body> </html> The above program returns the date of a date object as a string, using locale conventions.
🌐
Droidscript
droidscript.org › javascript › Global_Objects › Date › toLocaleDateString().html
dateObj.toLocaleDateString()
var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0)); // formats below assume the local time zone of the locale; // America/Los_Angeles for the US // US English uses month-day-year order console.log(date.toLocaleDateString('en-US')); // → "12/19/2012" // British English uses day-month-year ...
Find elsewhere
🌐
Sentry
sentry.io › sentry answers › javascript › how do i format a date in javascript?
How do I Format a Date in JavaScript? | Sentry
December 15, 2022 - const date = new Date(Date.UTC(2022, 10, 22, 9, 0, 0)); const date2 = new Date(Date.UTC(2022, 11, 22, 9, 0, 0)); const options = { weekday: "long", year: "numeric", month: "long", day: "numeric", }; console.log(date.toLocaleDateString("en-ZA", ...
🌐
Substack
patrickojeh.substack.com › p › a-guide-to-formatting-dates-with
A Guide to Formatting Dates with toLocaleDateString in JavaScript
January 10, 2025 - In this post, I’ll explore toLocaleDateString() — which is a flexible method that allows you to format dates in a user-friendly and locale-aware way.
🌐
Medium
medium.com › swlh › use-tolocaledatestring-to-format-javascript-dates-2959108ea020
Use toLocaleDateString to Format JavaScript Dates | by John Au-Yeung | The Startup | Medium
April 5, 2020 - For example, we can use it as follows: const date = new Date(2019,1,1,1,1,1); const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }; console.log(date.toLocaleDateString('de-DE', options)); The code above defines ...
🌐
Codeproject
reference.codeproject.com › javascript
javascript Date.prototype.toLocaleDateString() - CodeProject Reference
November 5, 2021 - function toLocaleDateStringSupportsLocales() { try { new Date().toLocaleDateString('i'); } catch (e) { return e.name === 'RangeError'; } return false; } This example shows some of the variations in localized date formats.
🌐
Linangdata
linangdata.com › snippets-of-javascript › format-date
How to format a JavaScript date?
July 13, 2022 - const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }; const today = new Date(); today.toLocaleDateString("en-US", options); // Thursday, September 15, 2022 · Another example returning a formatted date in Japanese.
🌐
Tabnine
tabnine.com › home page › code › javascript › date
builtins.Date.toLocaleDateString JavaScript and Node.js code examples | Tabnine
function upd() { list.changeDate.header.lastChild.innerHTML = new Date().toLocaleTimeString({}, { hour: '2-digit', minute: '2-digit' }) + ", " + new Date().toLocaleDateString({}, { weekday: 'long', year: 'numeric', month: 'short', day: 'numeric' }); }
🌐
xjavascript
xjavascript.com › blog › how-do-you-format-a-date-time-in-typescript
How to Format Date/Time in TypeScript: Using toLocaleDateString with Practical Examples — xjavascript.com
TypeScript (and JavaScript) provides a built-in solution: toLocaleDateString(). This method leverages the Intl API to format dates according to locale rules, time zones, and custom patterns—no manual string manipulation required. In this guide, we’ll deep dive into toLocaleDateString(), explore its parameters, and walk through practical examples to master date formatting in TypeScript.
🌐
Ceos3c
ceos3c.com › home › javascript › tolocaledatestring in javascript – for humans
toLocaleDateString in JavaScript - For Humans
June 30, 2022 - The toLocaleDateString() method returns a string representation of the date format in the user’s timezone.
🌐
W3Schools
w3schools.com › jsref › jsref_tolocalestring.asp
JavaScript Date toLocaleString() Method
new Date() constructor getDate() getDay() getFullYear() getHours() getMilliseconds() getMinutes() getMonth() getSeconds() getTime() getTimezoneOffset() getUTCDate() getUTCDay() getUTCFullYear() getUTCHours() getUTCMilliseconds() getUTCMinutes() getUTCMonth() getUTCSeconds() now() parse() prototype setDate() setFullYear() setHours() setMilliseconds() setMinutes() setMonth() setSeconds() setTime() setUTCDate() setUTCFullYear() setUTCHours() setUTCMilliseconds() setUTCMinutes() setUTCMonth() setUTCSeconds() toDateString() toISOString() toJSON() toLocaleDateString() toLocaleTimeString() toLocaleString() toString() toTimeString() toUTCString() UTC() valueOf() JS Function
🌐
MDN Web Docs
devdoc.net › web › developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › toLocaleDateString.html
Date.prototype.toLocaleDateString () - JavaScript | MDN
var date = new Date(Date.UTC(2012, 11, 12, 3, 0, 0)); // toLocaleDateString() without arguments depends on the implementation, // the default locale, and the default time zone console.log(date.toLocaleDateString()); // → "12/11/2012" if run in en-US locale with time zone America/Los_Angeles
🌐
GitHub
github.com › grafana › k6 › issues › 3731
Incorrect date format returned with Date.toLocaleDateString() · Issue #3731 · grafana/k6
May 3, 2024 - Date().toLocaleDateString('en-US') Expect 12/30/2012 : Actual 12/30/2012 Date().toLocaleDateString('en-CA') Expect 2012-12-30 : Actual 2012-12-30 Date().toLocaleDateString('en-GB') Expect 30/12/2012 : Actual 30/12/2012 Date().toLocaleDateSt...
Author   steverivers