view raw
leora leora - 7 months ago 53
Javascript Question

how to determine if date is weekend in javascript

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

Answer
var day = yourDateObject.getDay();
var isWeekend = (day == 6) || (day == 0);    // 6 = Saturday, 0 = Sunday