getters

Date.prototype.getDay

Returns the weekday of the date in LOCAL time as an integer from 0 (Sunday) to 6 (Saturday). Named confusingly close to getDate but returns something completely different.

date.getDay()

Parameters

Parameter Purpose
() no arguments; returns 0-6
0 Sunday (not Monday)
6 Saturday

Examples

console.log(new Date('2026-07-19T00:00:00Z').getUTCDay()); // 0 (Sunday)

Sunday = 0

const days=['Sun','Mon','Tue','Wed','Thu','Fri','Sat']; console.log(days[new Date().getDay()]);

weekday name

const isWeekend = d => d.getDay() % 6 === 0; console.log(isWeekend(new Date('2026-07-19'))); // true

0 or 6 = weekend

Gotcha

Returns 0-6 with Sunday=0 (US convention), not Monday=0 (ISO). For ISO weekday (Mon=1..Sun=7) use ((d.getDay() + 6) % 7) + 1.

Related

← All JS Date methods · Math methods · Cron syntax