References

Beginner-friendly references for web development, with live, editable examples.

The JavaScript date.toLocaleDateString() method

Method JavaScript All modern browsers Updated
Quick answer

The toLocaleDateString() method formats a Date as a human-readable string in the user's locale — "6/23/2026" in the US, "23/06/2026" in the UK. Pass a locale and an options object to control the style: date.toLocaleDateString("en-US", { dateStyle: "long" }) gives "June 23, 2026".

Overview

toLocaleDateString() formats a date for people, respecting their locale's conventions — which the US (month/day/year) and most of the world (day/month/year) write differently. Called with no arguments it uses the browser's locale; pass a locale string like "en-GB" or "de-DE" to force a specific one. This is the method to display a date in a UI, as opposed to toISOString(), which is for storage.

The second argument, an options object, controls the style. The easy way is dateStyle: "short", "medium", "long" or "full" (from "6/23/26" to "Tuesday, June 23, 2026"). For fine control you can set individual parts — { year: "numeric", month: "long", day: "numeric" } gives "June 23, 2026". There's a sibling toLocaleTimeString() for times and toLocaleString() for both.

Under the hood these methods use the Intl internationalization API. If you're formatting many dates, creating a reusable Intl.DateTimeFormat with your options is more efficient than calling toLocaleDateString() repeatedly. For storing or transmitting dates, don't use locale formatting at all — use toISOString().

Syntax

date.toLocaleDateString()
date.toLocaleDateString(locales, options)

d.toLocaleDateString("en-US")  // "6/23/2026"
d.toLocaleDateString("en-GB")  // "23/06/2026"
d.toLocaleDateString("en-US", { dateStyle: "long" }) // "June 23, 2026"

Parameters

The date.toLocaleDateString() method accepts the following parameters.

Parameter Description
locales Optional. A BCP 47 locale string (e.g. "en-US") or array. Defaults to the browser's locale.
options Optional. Formatting settings such as dateStyle, or individual year/month/day parts.

Example

Live example
<pre id="out" style="font:14px ui-monospace,monospace"></pre>
<script>
  const d = new Date(2026, 5, 23);

  document.getElementById('out').textContent =
    'en-US: ' + d.toLocaleDateString('en-US') + '\n' +
    'en-GB: ' + d.toLocaleDateString('en-GB') + '\n' +
    'long:  ' + d.toLocaleDateString('en-US', { dateStyle: 'long' });
</script>

Best practices

  • Use it to display dates to users; use toISOString() to store them.
  • Pass { dateStyle: "long" } for a quick readable format, or individual parts for fine control.
  • Specify a locale explicitly when you need a consistent format regardless of the user's settings.
  • For formatting many dates, reuse an Intl.DateTimeFormat instance for performance.

Frequently asked questions

How do I format a date for display in JavaScript?
Use date.toLocaleDateString(), optionally with a locale and options: date.toLocaleDateString("en-US", { dateStyle: "long" }).
How do I show the month name instead of a number?
Use options: { month: "long" } (or "short") gives the name, e.g. "June".
What is the difference between toLocaleDateString() and toISOString()?
toLocaleDateString() formats for humans in their locale; toISOString() produces a standard machine format for storage and transmission.
How do I include the time too?
Use toLocaleString() for date and time together, or toLocaleTimeString() for the time only.