getDay()

ES1+

Returns the day of the week (0-6) for the specified date according to local time.

Syntax

date.getDay()

Return Value

number

A number (0-6) representing the day of the week (0 = Sunday)

Examples

JavaScript
const date = new Date('2024-01-15'); // 월요일
const days = ['일', '월', '화', '수', '목', '금', '토'];
console.log(date.getDay());
console.log(days[date.getDay()] + '요일');
Output:
// 1 월요일

Related Methods