English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
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).
date.toLocaleDateString()
var d = new Date(); var str = d.toLocaleDateString(); document.getElementById('result').innerHTML = str;Test See‹/›
All browsers fully support the toLocaleDateString() method:
Method | |||||
toLocaleDateString() | Yes | Yes | Yes | Yes | Yes |
Return Value: | A string representing the 'date' part according to the conventions of the operating system's locale setting |
---|---|
JavaScript Version: | ECMAScript 1 |