views:

82

answers:

2

if i have a date coming into a function, how can i tell if its a weekend day?

+7  A: 
var day = yourDateObject.getDay();
var isWeekend = (day == 6) || (day == 0);    // 6 = Saturday, 0 = Sunday
LukeH
`d` != `day` :) I would rather call it `dayOfWeek`, it would make more sense to OP.
BalusC
+2  A: 
var isWeekend = yourDateObject.getDay()%6==0;
kennebec