getDay method
The getDay method is applied
to the date object
and returns the number of the day of
the week as a number from 0
to 6. Moreover, Sunday is the
day number 0, Monday is
1, etc.
Syntax
date.getDay();
Example
Let's output the number of the current day of the week:
let date = new Date();
let res = date.getDay();
console.log(res);
Example
Let's output the day of the week for a given date:
let date = new Date(2025, 11, 31);
let res = date.getDay();
console.log(res);
The code execution result:
3
See also
-
the
getFullYearmethod
that gets the year -
the
getMonthmethod
that gets the month -
the
getDatemethod
that gets the day of the month -
the
getHoursmethod
that gets the hours -
the
getMinutesmethod
that gets the minutes -
the
getSecondsmethod
that gets the seconds -
the
getMillisecondsmethod
that gets the milliseconds