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
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
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › toLocaleDateString
Date.prototype.toLocaleDateString() - JavaScript | MDN
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.
Discussions

sharepoint online - How to format toLocaleDateString([$MyDateTimeColumn]) to return YYYY-MM-DD? - SharePoint Stack Exchange
The link creation works correctly, however the date from toLocaleDateString() is output as: ... for the filter to be applied correctly (even though the value in the column is actually displayed as 21/12/20). How can I output the date value as YYYY-MM-DD so that the filter is applied correctly? More on sharepoint.stackexchange.com
🌐 sharepoint.stackexchange.com
December 21, 2020
Jquery new Date - Convert to yyyy-MM-dd and use toLocaleDateString
The browser tells me that for type=date, the format must be set to yyyy-MM-dd and not the Australian time format of dd/MM/yyyy. I am not sure how to go about enforcing the toLocaleDateString AND converting the date to yyyy-MM-dd. More on stackoverflow.com
🌐 stackoverflow.com
How do I get the date format string like YYYY-MM-DD for the current locale?
https://letmegooglethat.com/?q=javascript+format+date+yyyy-mm-dd More on reddit.com
🌐 r/learnjavascript
9
2
August 2, 2022
How do I format a date in JavaScript? - Stack Overflow
How do I format a Javascript Date object as a string? (Preferable format: 10-Aug-2010) More on stackoverflow.com
🌐 stackoverflow.com
🌐
Substack
patrickojeh.substack.com › p › a-guide-to-formatting-dates-with
A Guide to Formatting Dates with toLocaleDateString in ...
January 10, 2025 - The first parameter of ... const ISOString = '2025-01-15T10:00:00Z'; const date = new Date(ISOString); // US format (MM/DD/YYYY) console.log(date.toLocaleDateString('en-US')); // Output: "1/15/2025" // British format ...
🌐
W3Schools
w3schools.com › jsref › jsref_tolocaledatestring.asp
W3Schools.com
The toLocaleDateString() method returns the date (not the time) of a date object as a string, using locale conventions.
🌐
Medium
habtesoft.medium.com › 8-ways-of-date-formatting-in-javascript-1380625a1f50
8 Ways of Date Formatting in Javascript | by habtesoft | Medium
October 18, 2024 - const date = new Date(); // Default locale (browser's locale) console.log(date.toLocaleDateString()); // e.g., "9/20/2024" // Custom locale console.log(date.toLocaleDateString('en-GB')); // "20/09/2024" (dd/mm/yyyy) console.log(date.toLocaleDateString('en-US')); // "09/20/2024" (mm/dd/yyyy) console.log(date.toLocaleDateString('ja-JP')); // "2024/09/20" (yyyy/mm/dd) // Custom options console.log(date.toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' })); // "Friday, September 20, 2024"
🌐
GitHub
gist.github.com › 6737784
format current local date to "yyyy-MM-dd HH:mm:ss TZ-info" ...
format current local date to "yyyy-MM-dd HH:mm:ss TZ-info" on X-browser - toDateTimeTZInfoString.js
🌐
vimtutor
remarkablemark.org › blog › 2021 › 07 › 31 › javascript-date-format-string
Format JavaScript date into yyyy-MM-dd | remarkablemark
July 31, 2021 - With Date.prototype.toISOString(): new Date().toISOString().split('T')[0]; Which is equivalent to: new Date().toISOString().slice(0, 10); With Date.prototype.toLocaleDateString(): new Date().toLocaleDateString('en-CA'); With date instance methods: ...
Find elsewhere
🌐
MSR
rajamsr.com › home › javascript date format yyyy-mm-dd: easy way to format
Javascript Date Format YYYY-MM-DD: Easy Way to Format | MSR - Web Dev Simplified
March 3, 2024 - To format a JavaScript date using toLocaleDateString() with the format yyyy-mm-dd hh:mm:ss, you can use the following code.
🌐
Linangdata
linangdata.com › snippets-of-javascript › format-date
How to format a JavaScript date?
July 13, 2022 - It is different to toLocaleDateString in that it returns the time as well. const today = new Date(); today.toLocaleString("en-US", { timeZone: 'UTC' }) // 9/15/2022, 4:11:26 PM · Use the format() method from moment to a date to a formatted date.
🌐
Tutorial Republic
tutorialrepublic.com › faq › how-to-format-javascript-date-as-yyyy-mm-dd.php
How to Format JavaScript Date as YYYY-MM-DD
// Create a date object from a ...ng("default", { day: "2-digit" }); // Generate yyyy-mm-dd date string var formattedDate = year + "-" + month + "-" + day; console.log(formattedDate); // Prints: 2022-05-04...
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-get-current-formatted-date-dd-mm-yyyy-in-javascript-and-append-it-to-an-input
How to get current formatted date dd/mm/yyyy in Javascript and append it to an input? - GeeksforGeeks
July 11, 2025 - To display dd/mm/yyyy, set the locale to 'en-GB'. Use the valueAsDate property to assign the current date as a Date object to an input field. ... Example: In this example we displays the current date using JavaScript's toLocaleDateString() method ...
🌐
SPGuides
spguides.com › convert-date-to-string-format-dd-mm-yyyy-in-typescript
How to Convert Date to String Format dd/mm/yyyy in Typescript
November 13, 2023 - The toLocaleDateString method is a straightforward way to format a date in TypeScript. It converts a date to a string using the locale and options we specify. To format a date as DD/MM/YYYY, we can pass the appropriate options to this method.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-format-javascript-date-as-yyyy-mm-dd
How To Format JavaScript Date as yyyy-mm-dd? - GeeksforGeeks
June 24, 2025 - Example: In this example, we will ... as yyyy-mm-dd ... const formatDateISO = (date) => { return date.toLocaleDateString('en-CA'); }; const currentDate = new Date(); console.log(formatDateISO(currentDate));...
🌐
Codecademy
codecademy.com › docs › javascript › dates › .tolocaledatestring()
JavaScript | Dates | .toLocaleDateString() | Codecademy
June 2, 2023 - When used without any parameters, .toLocaleDateString() returns a string with the month, day, and year options defaulted to numeric. How they’re arranged and formatted depends on the default locale in which the method was used.
🌐
freeCodeCamp
freecodecamp.org › news › how-to-format-a-date-with-javascript-date-formatting-in-js
How to Format a Date with JavaScript – Date Formatting in JS
November 7, 2024 - toLocaleDateString(): This method returns a string representing the date portion of a Date object using the system's local conventions.
🌐
Reddit
reddit.com › r/learnjavascript › how do i get the date format string like yyyy-mm-dd for the current locale?
r/learnjavascript on Reddit: How do I get the date format string like YYYY-MM-DD for the current locale?
August 2, 2022 -

Hi, as the title says, I'm not trying to format a date, but I'm trying to get the format string that would be used to format the date. date.toLocaleDateString("de-DE") Would format today's date as 7.9.2022, but I would like the formatting string for any locale instead. I already looked into the docs for Firefox which just said, that it uses the OS's preferences to format each locale, but their was no mention on how to retrieve those preferences.

Does anyone know how to do that?

Thanks in advance for your help.