JavaScript Code


JavaScript – Get UTC Day of Week from Date


Date – getUTCDay()

date.getUTCDay()

getUTCDay() returns the day of week, an integer from 0 to 6, of this date object, according to universal time. 0 for Sunday, 1 for Monday, 2 for Tuesday, 3 for Wednesday, 4 for Thursday, 5 for Friday, or 6 for Saturday

Examples

1. find the day of week for the current date according to universal time

let date = new Date();
console.log(date);
console.log(date.getUTCDay());


Copyright @2022