//已知的2个日期 判断是否有星期几 function isWeekDay(s1,s2,wk){ var obj=true; s1 = s1.replace(/-/g, "/"); s2 = s2.replace(/-/g, "/"); s1 = new Date(s1); s2 = new Date(s2); //计算相差天数 var days= s2.getTime() - s1.getTime(); var time = parseInt(days/1000/3600/24)+1; s1.setDate(s1.getDate()-1); for(var i =0 ;i<time ;i++) { s1.setDate(s1.getDate()+1); //当选择有该日期则返回flase if(s1.getDay()==wk) { obj=false; } //输出2个日期之间的星期 //alert(s1.getDay()); } return obj; }
?