toLocaleDateString() Interactive Tester

What is toLocaleDateString()?

The toLocaleDateString() method returns a string with a language-sensitive representation of the date portion of a Date object. It allows you to format dates according to different locales and customize how various date components are displayed.

Syntax: dateObj.toLocaleDateString([locales[, options]])

Test Date

Choose any date to see how it's formatted with different options

Locale Settings

Locale

The locale determines the language and regional formatting conventions. Different locales have different date formats, month names, and ordering of date components.

Formatting Options

Date Style (Preset Combinations)

dateStyle provides preset combinations of date formatting. When set, it overrides individual component options below.

Weekday

Controls how the day of the week is displayed

Era

Displays the era (useful for historical dates or certain calendars)

Year

Controls how the year is displayed

Month

Controls how the month is displayed

Day

Controls how the day of the month is displayed

Time Zone

Specifies the time zone to use. This can affect the date shown if near midnight.

Calendar & Numbering System

Changes the calendar system used for the date
Changes the numbering system for numeric values

Result

Select options and click "Format Date"
// Code will appear here