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 ... 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
JavaScript Date toLocaleDateString() Method
The toLocaleDateString() method returns the date (not the time) of a date object as a string, using locale conventions.
🌐
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 ...
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › toLocaleString
Date.prototype.toLocaleString() - JavaScript | MDN
The toLocaleString() method of Date instances returns a string with a language-sensitive representation of this date in the local timezone. In implementations with Intl.DateTimeFormat API support, this method delegates to Intl.DateTimeFormat.
🌐
GitHub
github.com › nodejs › node › issues › 45945
ToLocaleDateString inconsistent/wrong output locale to "en-CA" · Issue #45945 · nodejs/node
September 3, 2022 - To get the format YYYY-MM-DD you could return to node 19.0.0 or use 'sv-SE' locale instead · Below some others locales that i'ave tested that properly works · 👍React with 👍4mirek, chrisfcarroll, sameerdash2 and bryan-hoang
Author   crowrvo
Find elsewhere
Top answer
1 of 4
31

toLocaleDateString is intended to provide a human-readable format, according to the rules of the user's own computer. For instance, if my computer is set to French, it might include the day name in French.

toLocaleDateString is NOT a reliable way of getting the format you want. Instead, do this:

var dateobj = new Date();
function pad(n) {return n < 10 ? "0"+n : n;}
var result = pad(dateobj.getDate())+"/"+pad(dateobj.getMonth()+1)+"/"+dateobj.getFullYear();
2 of 4
18

I was looking for an answer to this question, but above answers doesn't give a crip answer for converting date to dd/mm/yyyy using toLocaleDateString().

As per docs toLocaleDateString() converts a date to a string with a language sensitive representation of the date portion. This method accepts two parameters dateObj.toLocaleDateString( [locales][, options]) described below :

  • locales: This parameter is an array of locale strings that contain one or more language or locale tags.Note that it is an optional parameter.If you want to use specific format of the language in your application then specify that language in the locales argument.Some parameters are:

    • en-US : US English uses month-day-year order i.e 07/17/2020
    • en-GB : British English uses day-month-year order i.e 17/07/2020
    • ko-KR : Korean uses year-month-day order i.e 2020. 07. 17.
  • options: It is also an optional parameter and contains properties that specify comparison options.Some properties are localeMatcher, timeZone, weekday, year, month, day, hour, minute, second etc.

So using this here is how you can convert date to dd/mm/yyyy format:

let dateFormat=new Date().toLocaleDateString('en-GB', {
month: '2-digit',day: '2-digit',year: 'numeric'})
console.log(dateFormat)

for persian date (current date)

const p2e = s => s.replace(/[۰-۹]/g, d => '۰۱۲۳۴۵۶۷۸۹'.indexOf(d))
const dateFormat = p2e(new Date().toLocaleDateString('fa-IR', { month: '2-digit', day: '2-digit', year: 'numeric' }))
console.log(dateFormat)

🌐
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 ...
🌐
freeCodeCamp
forum.freecodecamp.org › javascript
How to convert date to dd-mm-yyyy in react
November 19, 2020 - Hi, I am new to react (just three days) and I currently doing a project using my past experience in Jquery and ASP.NET to write the project. The challenge I am currently having now is how to convert date in JSON (2018-…
🌐
LogRocket
blog.logrocket.com › home › how to format dates in javascript: methods, libraries, and best practices
How to format dates in JavaScript: Methods, libraries, and best practices - LogRocket Blog
May 8, 2025 - import dayjs from 'dayjs'; import utc from 'dayjs/plugin/utc'; import timezone from 'dayjs/plugin/timezone'; import localeData from 'dayjs/plugin/localeData'; import customParseFormat from 'dayjs/plugin/customParseFormat'; // Extend with plugins dayjs.extend(utc); dayjs.extend(timezone); dayjs.extend(localeData); dayjs.extend(customParseFormat); // Creating Day.js objects const today = dayjs(); const specificDate = dayjs('2025-02-18'); const fromFormat = dayjs('18/02/2025', 'DD/MM/YYYY'); // Formatting specificDate.format('YYYY-MM-DD'); // "2025-02-18" specificDate.format('dddd, MMMM D, YYYY')
🌐
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));...
🌐
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"
🌐
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', ...