Get the weekday:
let day = d.getUTCDay();
Get the name of the weekday (not just a number):
const d = new Date();
let day = weekday[d.getUTCDay()];
Definition and Usage
getUTCDay() returns the day of the week (0 to 6) of a date.
getUTCDay() returns the day of the week according to universal time.
Sunday = 0, Monday = 1, ... (See below):
UTC (Universal Time Coordinated) is the time set by the World Time Standard.
UTC time is the same as GMT time (Greenwich Mean Time).
|A number||The weekday of a date (0 to 6), according to UTC.|
getUTCDay() is an ECMAScript1 (ES1) feature.