 <pre><code>function isBusinessDay(theDate){ theDay = theDate.getDay(); // Get day returns 0-6, respectively Sunday - Saturday if(theDay == 0 || theDay == 6){ return false; } else { return true; } } </code></pre> <p>Use with zzzzBov's <code>while (!isBusinessDay(date)) { date.setDate(date.getDate() - 1) }</code></p> <p>A more concise way to write it :</p> <pre><code>function isBusinessDay(theDate){ theDay = theDate.getDay(); // Get day returns 0-6, respectively Sunday - Saturday if(theDay == 0 || theDay == 6) return false; return true; } </code></pre>