Date.prototype.getDay
Returns the day of the week — a number from 0 to 6, where 0 is Sunday.
Available since: ES1
Syntax
date.getDay()Return value
numberThe day of the week from 0 (Sunday) to 6 (Saturday).
Examples
March 15, 2026 is a Sunday:
console.log(new Date(2026, 2, 15).getDay());Output:
0A weekend check:
const day = new Date(2026, 2, 14).getDay();
console.log(day === 0 || day === 6 ? 'weekend' : 'weekday');Output:
weekendNotes
The week starts on Sunday here. The day name in any language comes from toLocaleDateString('en-US', { weekday: 'long' }).
See also
- Date.prototype.getDate — Returns the day of the month.
- Date.prototype.toLocaleDateString — Formats a date without time by language rules.
Related recipes
In the tutorial
- Dates and time — The Date object in JavaScript: creating a date, reading the year, month and day, changing a date, the difference between dates and the ISO format.