you can use

{new Date(**your date**).toLocaleDateString()}

Cheers !

Answer from janadari ekanayaka on Stack Overflow
🌐
Peterbe.com
peterbe.com › plog › be-careful-with-date.tolocaledatestring
Be careful with Date.toLocaleDateString() in JavaScript - Peterbe.com
> process.env.TZ undefined > new Date('2014-11-27T02:50:49Z').toLocaleDateString("en-us", {day: "numeric"}) '27' What! Despite $TZ not being set, it formats according to something else. 02:50 Zulu means, to me, in the US Eastern time zone, the day before. I kept getting this production error from React that the SSR-rendered HTML differed from the client-side rendered HTML.
🌐
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.
🌐
Reactgo
reactgo.com › home › how to format the date and time in javascript
How to format the date and time in JavaScript | Reactgo
December 8, 2022 - const options = { timeZone:"Asia/Kolkata", hour12 : false, hour: "2-digit", minute: "2-digit", second: "2-digit" } new Date().toLocaleTimeString("en-US",options); //Asia/Kolkata timezone with 24hr time "13:42:31"
🌐
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. Date.toLocaleDateString(locales, options) JavaScript Dates · JavaScript Date Formats · JavaScript Date Get Methods · ...
🌐
GitHub
github.com › facebook › react-native › issues › 29824
toLocaleDateString() does not work in Android. The date format gets trimmed from 'yyyy' to 'yy' (iOS does work correctly) · Issue #29824 · facebook/react-native
September 1, 2020 - JavaScriptNeeds: AttentionIssues ... by the bot. ... When using Dates in React Native, the method toLocaleDateString() clips the date....
Author   RSP531
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-date-tolocaledatestring-method
JavaScript Date toLocaleDateString() Method - GeeksforGeeks
July 11, 2025 - The toLocaleDateString() method in JavaScript is used to convert the date and time of a Date object to a string representing the date portion using the locale-specific conventions.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › toLocaleString
Date.prototype.toLocaleString() - JavaScript | MDN
// 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.toLocaleString("en-US", { hour12: false })); // Example output: "12/19/2012, 19:00:00" // The exact date and time may shift depending on your local time zone. Intl.DateTimeFormat · Date.prototype.toLocaleDateString() Date.prototype.toLocaleTimeString() Date.prototype.toString() Was this page helpful to you? Yes · No Learn how to contribute · This page was last modified on Oct 30, 2025 by MDN contributors. View this page on GitHub • Report a problem with this content
🌐
Marmelab
marmelab.com › react-admin › DateField.html
React-admin - The DateField Component
When showDate is false, <DateField> uses the date.toLocaleTimeString() to format the time. By default, <DateField> displays a date using date.toLocaleDateString().
Find elsewhere
🌐
Tabnine
tabnine.com › home page › code › javascript › date
builtins.Date.toLocaleDateString JavaScript and Node.js code examples | Tabnine
id="gatewayBilling.accountCancelled" ... return date.toLocaleDateString("en", options); } Returns a date as a string value appropriate to the host environment's current locale....
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › toLocaleTimeString
Date.prototype.toLocaleTimeString() - JavaScript | MDN
const date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0)); // An application may want to use UTC and make that visible const options = { timeZone: "UTC", timeZoneName: "short" }; console.log(date.toLocaleTimeString("en-US", options)); // "3:00:00 AM GMT" // Sometimes even the US needs 24-hour time console.log(date.toLocaleTimeString("en-US", { hour12: false })); // "19:00:00" // Show only hours and minutes, use options with the default locale - use an empty array console.log( date.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }), ); // "20:01" Intl.DateTimeFormat · Date.prototype.toLocaleDateString() Date.prototype.toLocaleString() Date.prototype.toTimeString() Date.prototype.toString() Was this page helpful to you?
🌐
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.
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
🌐
Bobby Hadz
bobbyhadz.com › blog › javascript-typeerror-tolocaledatestring-is-not-a-function
TypeError: toLocaleDateString is not a function in JS [Fix] | bobbyhadz
To solve the error, convert the value to a date before calling the method or make sure to only call the toLocaleDateString method on valid dates.
Top answer
1 of 16
225

Seems the most foolproof way to start with a UTC date is to create a new Date object and use the setUTC… methods to set it to the date/time you want.

Then the various toLocale…String methods will provide localized output.

Example:

// This would come from the server.
// Also, this whole block could probably be made into an mktime function.
// All very bare here for quick grasping.
d = new Date();
d.setUTCFullYear(2004);
d.setUTCMonth(1);
d.setUTCDate(29);
d.setUTCHours(2);
d.setUTCMinutes(45);
d.setUTCSeconds(26);

console.log(d);                        // -> Sat Feb 28 2004 23:45:26 GMT-0300 (BRT)
console.log(d.toLocaleString());       // -> Sat Feb 28 23:45:26 2004
console.log(d.toLocaleDateString());   // -> 02/28/2004
console.log(d.toLocaleTimeString());   // -> 23:45:26

Some references:

  • toLocaleString
  • toLocaleDateString
  • toLocaleTimeString
  • getTimezoneOffset
2 of 16
66

You can do it with moment.js (deprecated in 2021)

It's best to parse your date string from UTC as follows (create an ISO-8601 compatible string on the server to get consistent results across all browsers):

var m = moment("2013-02-08T09:30:26Z");

Now just use m in your application, moment.js defaults to the local timezone for display operations. There are many ways to format the date and time values or extract portions of it.

You can even format a moment object in the users locale like this:

m.format('LLL') // Returns "February 8 2013 8:30 AM" on en-us

To transform a moment.js object into a different timezone (i.e. neither the local one nor UTC), you'll need the moment.js timezone extension. That page has also some examples, it's pretty simple to use.

Note: Moment JS recommends more modern alternatives, so it is probably not a good choice for new projects.

🌐
ReactHustle
reacthustle.com › blog › react-format-date-ultimate-guide
Ultimate Guide: How to Format Date in React | ReactHustle
const ComponentB = () => { const date = new Date(2023, 2, 19, 15, 57, 25); const formatted = date.toLocaleDateString("en", { year: "numeric", month: "short", }); // Mar 2023 const formatted2 = date.toLocaleDateString("en", { year: "numeric", month: "long", }); // March 2023 const formatted3 = date.toLocaleDateString("en", { year: "numeric", day: "2-digit", month: "long", }); // March 19, 2023 return ( <div className="p-4"> <p>formatted: {formatted}</p> <p>formatted: {formatted2}</p> <p>formatted: {formatted3}</p> </div> ); }; export default ComponentB; ... You learned how to format dates in react using dayjs and the Intl.DateTimeFormat API.
🌐
Carl Rippon
carlrippon.com › formatting-dates-and-numbers-in-react
Formatting dates and numbers in React
<td>{customer.firstSale.toLocaleDateString()}</td> … which gives us a nice short date: However, we can use Intl.DateTimeFormat to gain more control on the formatting: <td> {new Intl.DateTimeFormat("en-GB", { year: "numeric", month: "long", day: "2-digit" }).format(customer.firstSale)} </td> Here we are specifying a 2 digit day, a long month and a 4 digit year. So, here’s our final CustomerSearchResults component code: CustomerSearchResults.tsx · import * as React from "react"; import Customer from "./Customer"; interface CustomerSearchResultsProps { customers: Customer[]; } const Customer
🌐
Medium
medium.com › geekculture › level-up-your-date-and-time-formatting-skills-in-javascript-866d8b656092
Level Up Your Date and Time Formatting Skills in JavaScript | by Danielle Dias | Geek Culture | Medium
May 26, 2023 - Like toLocaleDateString(), this method also supports localization and additional options, such as specifying the time zone. To get the default time string based on the user’s locale, we can simply call toLocaleTimeString() without any parameters.