Javascript - Get the Day of The Week

You can use methods like this to easily get which day of the week we it is now.

function isMonday() {
    d = new Date().getDay();
    return d === 1;
}
function isMondayOrSunday() {
    d = new Date().getDay();
    return d === 0 || d === 1;
}

but for the convenience and also not to have to remember where the week starts (it starts on Sunday with 0) you can use something like the following:

function getDayOfWeek() {
    var d = new Date();
    var weekday = new Array(7);
    weekday[0] = "Sunday";
    weekday[1] = "Monday";
    weekday[2] = "Tuesday";
    weekday[3] = "Wednesday";
    weekday[4] = "Thursday";
    weekday[5] = "Friday";
    weekday[6] = "Saturday";

    return weekday[d.getDay()];
}

Paired together with the previous post about obtaining any timezone for the date, you can use these methods for any timezone replacing the new Date() with the getGMTRelativeDate(GMT_offsetHours)

e.g.

function isMonday() {
    d = getGMTRelativeDate(-5).getDay();  // for EST time
    return d === 1;
}