朋友问到的关于ASP求指定日期范围内第N周包含的日期
<%
'追梦客
'2009-9-11
Function GetDateRangWeek(minDate,maxDate,weekIndex)
dim daterang
dim idx
for idx=0 to DateDiff("d",minDate,maxDate)
if DateDiff("ww",minDate,DateAdd("d",minDate,idx))=(weekIndex-1) then
daterang = daterang & DateAdd("d",minDate,idx) & ","
end if
next
GetDateRangWeek = daterang
End Function
response.Write(GetDateRangWeek(CDate("2009-9-12"),CDate("2009-9-29"),3))
%>
'追梦客
'2009-9-11
Function GetDateRangWeek(minDate,maxDate,weekIndex)
dim daterang
dim idx
for idx=0 to DateDiff("d",minDate,maxDate)
if DateDiff("ww",minDate,DateAdd("d",minDate,idx))=(weekIndex-1) then
daterang = daterang & DateAdd("d",minDate,idx) & ","
end if
next
GetDateRangWeek = daterang
End Function
response.Write(GetDateRangWeek(CDate("2009-9-12"),CDate("2009-9-29"),3))
%>