给定时间段内 起2009-5-31 至 2009-6-30
选定任意周 比如说 周一,周三,周六
得到所有这时间段内的具体时间
2009-6-1
2009-6-3
2009-6-6
2009-6-8
2009-6-10
2009-6-13
2009-6-15
2009-6-17
2009-6-22
2009-6-20
2009-6-24
2009-6-27
2009-6-29
这个用语言javascript 或 asp 或sql
如何来分别写实现函数
2 个解决方案
#1
<html>
<head>
<script type="text/javascript" defer>
var selectDay = "136";
var s = "2009-5-31";
var e = "2009-6-30";
var sDate = new Date(s.split("-")[0],s.split("-")[1]-1,s.split("-")[2]);
var eDate = new Date(e.split("-")[0],e.split("-")[1]-1,e.split("-")[2]);
for(;sDate<=eDate;sDate.setTime(sDate.getTime()+24*60*60*1000)){
if(selectDay.indexOf(sDate.getDay())>=0){
document.writeln(sDate.getFullYear()+"-"+(sDate.getMonth()+1)+"-"+sDate.getDate()+"<br>");
}
}
</script>
</head>
<body>
</body>
</html>
#2
感谢感谢!
#1
<html>
<head>
<script type="text/javascript" defer>
var selectDay = "136";
var s = "2009-5-31";
var e = "2009-6-30";
var sDate = new Date(s.split("-")[0],s.split("-")[1]-1,s.split("-")[2]);
var eDate = new Date(e.split("-")[0],e.split("-")[1]-1,e.split("-")[2]);
for(;sDate<=eDate;sDate.setTime(sDate.getTime()+24*60*60*1000)){
if(selectDay.indexOf(sDate.getDay())>=0){
document.writeln(sDate.getFullYear()+"-"+(sDate.getMonth()+1)+"-"+sDate.getDate()+"<br>");
}
}
</script>
</head>
<body>
</body>
</html>
#2
感谢感谢!