toLocaleDateString()
ES1+Returns the date portion of the Date as a string, using locale conventions.
Syntax
date.toLocaleDateString(locales, options)Parameters
locales string | Array optionalA string with a BCP 47 language tag
options Object optionalAn object with configuration properties
Return Value
string
A string representing the date portion
Examples
JavaScript
const date = new Date('2024-01-15');
console.log(date.toLocaleDateString('ko-KR'));
console.log(date.toLocaleDateString('en-US', {
weekday: 'long',
year: 'numeric',
month: 'long',
day: 'numeric'
})); Output:
// '2024. 1. 15.'
'Monday, January 15, 2024'