Date toLocaleDateString()
Example
Get a date as a string, using locale conventions:
const d = new Date();
let text = d.toLocaleDateString();
Try it Yourself »
let text = d.toLocaleDateString();
Description
The toLocaleDateString() method returns the date (not the time) of a date object as a string, using locale conventions.
Syntax
Date.toLocaleDateString(locales, options)
Parameters
Parameter
Description
locales
Optional.
Which language specific format to use.
Which language specific format to use.
options
Optional.
An object where you can set properties to use.
An object where you can set properties to use.
Return Value
Type
Description
String The date and time.
Legal Locales
| Property | Country |
|---|---|
| ar-SA | Arabic (Saudi Arabia) |
| bn-BD | Bangla (Bangladesh) |
| bn-IN | Bangla (India) |
| cs-CZ | Czech (Czech Republic) |
| da-DK | Danish (Denmark) |
| de-AT | Austrian German |
| de-CH | Swiss German |
| de-DE | Standard German |
| el-GR | Modern Greek |
| en-AU | Australian English |
| en-CA | Canadian English |
| en-GB | British English |
| en-IE | Irish English |
| en-IN | Indian English |
| en-NZ | New Zealand English |
| en-US | US English |
| en-ZA | English (South Africa) |
| es-AR | Argentine Spanish |
| es-CL | Chilean Spanish |
| es-CO | Colombian Spanish |
| es-ES | Castilian Spanish |
| es-MX | Mexican Spanish |
| es-US | American Spanish |
| fa-IR | Iranian (Iran) |
| fi-FI | Finnish (Finland) |
| fr-BE | Belgian French |
| fr-CA | Canadian French |
| fr-CH | Swiss French |
| fr-FR | Standard French (France) |
| he-IL | Hebrew (Israel) |
| hi-IN | Hindi (India) |
| hu-HU | Hungarian (Hungary) |
| id-ID | Indonesian (Indonesia) |
| it-CH | Swiss Italian |
| it-IT | Standard Italian |
| ja-JP | Japanese (Japan) |
| ko-KR | Korean (Republic of Korea) |
| nl-BE | Belgian Dutch |
| nl-NL | Standard Dutch (Netherlands) |
| no-NO | Norwegian (Norway) |
| pl-PL | Polish (Poland) |
| pt-BR | Brazilian Portuguese |
| pt-PT | European Portuguese (Portugal) |
| ro-RO | Romanian (Romania) |
| ru-RU | Russian (Russian Federation) |
| sk-SK | Slovak (Slovakia) |
| sv-SE | Swedish (Sweden) |
| ta-IN | Indian Tamil |
| ta-LK | Sri Lankan Tamil |
| th-TH | Thai (Thailand) |
| tr-TR | Turkish (Turkey) |
| zh-CN | Mainland China (simplified) |
| zh-HK | Hong Kong (traditional) |
| zh-TW | Taiwan (traditional) |
Legal Properties
| Property | Legal Values |
|---|---|
| dateStyle | "full" "long" "medium" "short" |
| timeStyle | "full" "long" "medium" "short" |
| localeMatcher |
"best-fit" (default) "lookup" |
| timeZone | |
| hour12 |
false true |
| hourCycle |
"h11" "h12" "h23" "h24" |
| formatMatcher |
"basic" "best-fit" (default) |
| weekday |
"long" "short" "narrow" |
| year |
"2-digit" "numeric" |
| month |
"2-digit" "long" "narrow" "numeric" "short" |
| day |
"2-digit" "numeric" |
| hour |
"2-digit" "numeric" |
| minute |
"2-digit" "numeric" |
| second |
"2-digit" "numeric" |
| timeZoneName |
"long" "short" |
Related Pages:
Browser Support
toLocaleDateString() is an ECMAScript1 (JavaScript 1997) feature.
It is supported in all browsers:
| Chrome | Edge | Firefox | Safari | Opera |