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.
🌐
Substack
patrickojeh.substack.com › p › a-guide-to-formatting-dates-with
A Guide to Formatting Dates with toLocaleDateString in JavaScript
January 10, 2025 - The first parameter of toLocaleDateString() is the locale string — which would be en-US for American English, en-GB for British English, or ja-JP for Japanese. 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 (DD/MM/YYYY) console.log(date.toLocaleDateString('en-GB')); // Output: "15/01/2025" // Japanese format (YYYY/MM/DD) console.log(date.toLocaleDateString('ja-JP')); // Output: "2025/01/15"
🌐
W3Schools
w3schools.com › jsref › jsref_tolocaledatestring.asp
JavaScript Date toLocaleDateString() Method
The toLocaleDateString() method returns the date (not the time) of a date object as a string, using locale conventions. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: ...
🌐
Mastering JS
masteringjs.io › tutorials › fundamentals › date-tostring-format-yyyy-mm-dd
Format a JavaScript Date to YYYY MM DD - Mastering JS
To format a date to YYYYMMDD in JavaScript, you can use the toLocaleDateString() function in combination with the split(), reverse(), and join() functions. The trick is that, in the UK, dates are formatted in DD/MM/YYYY format, with two digit ...
🌐
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...
🌐
Codecademy
codecademy.com › docs › javascript › dates › .tolocaledatestring()
JavaScript | Dates | .toLocaleDateString() | Codecademy
June 2, 2023 - Beginner Friendly.Beginner Friendly15 hours15 hours · const myEventDate = new Date('December 31, 2021'); ... When used without any parameters, .toLocaleDateString() returns a string with the month, day, and year options defaulted to numeric.
🌐
GitHub
gist.github.com › noromanba › 6737784
format current local date to "yyyy-MM-dd HH:mm:ss TZ-info" on X-browser · GitHub
Date.prototype.toISOString() - JavaScript | MDN · // run at 2014-11-20 02:+ (JST) var now = new Date(); now.toISOString().substr(0, 10); // "2014-11-19" now.toISOString(); // "2014-11-19T17:30:34.015Z" now.toString(); // same as `Date()` // "Thu Nov 20 2014 02:30:34 GMT+0900 (JST)" thx nice tips! now.toISOString().substr(0, 10); LGTM 👍 · Copy link · new Date().toLocaleDateString('fr-ca'); // $> 2020-03-05 ·
🌐
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"
Find elsewhere
🌐
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.
🌐
GeeksforGeeks
geeksforgeeks.org › 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
May 1, 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 ...
🌐
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: ...
🌐
Mastering JS
masteringjs.io › tutorials › fundamentals › date_format
Format Dates Using Vanilla JavaScript - Mastering JS
There's no way to output YYYY-MM-DD using the 'en-US' locale, but you can do it with the 'fr-CA' locale. const date = new Date('2019-06-01T00:00:00.000'); // "June 01, 2019, 2 AM" date.toLocaleDateString('fr-CA', { year: 'numeric', month: '2-digit', ...
🌐
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));...
🌐
Bobby Hadz
bobbyhadz.com › blog › javascript-format-date-yyyymmdd
Format a Date as YYYY-MM-DD using JavaScript | bobbyhadz
Passing a locale of sv to the toLocaleDateString method returns a Date string formatted as YYYY-MM-DD.
🌐
GitHub
github.com › grafana › k6 › issues › 3731
Incorrect date format returned with Date.toLocaleDateString() · Issue #3731 · grafana/k6
May 3, 2024 - The js function Date().toLocaleDateString() always returns MM/DD/YYYY regardless of localization string.
Author   steverivers