English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

JavaScript toLocaleDateString() Method

 JavaScript Date Object

toLocaleDateString()Returns a string representing the date part of the date object, the format of which is associated with the system settings of the region (locality sensitive).

toLocaleDateString()The method depends on the underlying operating system for formatting dates.

For example, in the United States, the month appears before the date (06/22/2018before, while in India, the date appears before the month (22/06/2018before).

Syntax:

date.toLocaleDateString()
var d = new Date();
var str = d.toLocaleDateString();
document.getElementById('result').innerHTML = str;
Test See‹/›

Browser Compatibility

All browsers fully support the toLocaleDateString() method:

Method
toLocaleDateString()YesYesYesYesYes

Technical Details

Return Value:A string representing the 'date' part according to the conventions of the operating system's locale setting
JavaScript Version:ECMAScript 1

 JavaScript Date Object