关于一个日期的问题 (在线等)
代码如下
<%
dim intyear,intmonth
dim rs,rs1,rds
dim inttempmonth
dim strsql
dim i
set rs=server.createobject("ADODB.RECORDSET")
set rs1=server.createobject("ADODB.RECORDSET")
intYear=request("Year")
intMonth=request("Month")
if intyear="" then
intyear=year(now)
end if
if intmonth="" then
intmonth=month(now)
end if
if intMonth=0 then
intYear=intYear-1
intMonth=12
end if
if intMonth=13 then
intYear=intYear+1
intMonth=1
end if
Response.Write "<center><FONT color=blue size=4><STRONG>"
Response.Write intYear
Response.Write "年"
Response.Write intMonth
Response.Write "月工作安排 </STRONG></FONT>" & vbcrlf
set rds=server.CreateObject("adodb.recordset")
strsql="select * from [工作安排月] where 年份=" & intyear & " and 月份=" & intmonth
rds.Open strsql,conn,1,1
if rds.eof=false and rds.bof=false then
response.write "<a target='listFrame' href=arrangelist.asp?type=month&year=" & intyear & "&month="& intmonth & ">显示月工作安排</a>"
end if
rds.close
response.write "<a href=workarrange.asp?Month=" & intMonth-1 & "&Year=" & intYear & ">[上月]</a>"
response.write "<a href=workarrange.asp?Month=" & intMonth+1 & "&Year=" & intYear & ">[下月]</a>"
response.write "</CENTER>"
response.write "<div align=center><table width='70%' border=0 cellspacing=1 cellpadding=4>" & vbcrlf
Response.Write "<tr>"
response.write "<td width='12%' align=center bgcolor=#77a2d9 ><font color=#FEF7ED>"
Response.Write "周安排"
Response.Write "</font></td>" & vbcrlf
response.write "<td width='8%' align=center bgcolor=#77a2d9 ><font color=#FEF7ED>"
Response.Write "星期一"
Response.Write "</font></td>" & vbcrlf
response.write "<td width='8%' align=center bgcolor=#77a2d9 ><font color=#FEF7ED>"
Response.Write "星期二"
Response.Write "</font></td>" & vbcrlf
response.write "<td width='8%' align=center bgcolor=#77a2d9 ><font color=#FEF7ED>"
Response.Write "星期三"
Response.Write "</font></td>" & vbcrlf
response.write "<td width='8%' align=center bgcolor=#77a2d9 ><font color=#FEF7ED>"
Response.Write "星期四"
Response.Write "</font></td>" & vbcrlf
response.write "<td width='8%' align=center bgcolor=#77a2d9 ><font color=#FEF7ED>"
Response.Write "星期五"
Response.Write "</font></td>" & vbcrlf
response.write "<td width='8%' align=center bgcolor=#77a2d9 ><font color=#FEF7ED>"
Response.Write "星期六"
Response.Write "</font></td>" & vbcrlf
response.write "<td width='8%' align=center bgcolor=#77a2d9 ><font color=#FEF7ED>"
Response.Write "星期日"
Response.Write "</font></td>" & vbcrlf
Response.Write "</tr>"
'Response.Write intyear &":" & intmonth
'Response.End
dim datinitdate
dim intinitweekday
dim datenddate
dim intendweekday
dim intweek
intinitweekday=weekday(dateserial(intYear,intMonth,1))'计算开始日期
if intinitweekday=1 then
intinitweekday=8
end if
datinitdate=dateserial(intYear,intMonth,1-intinitweekday+2)
intendweekday=weekday(dateserial(intYear,intMonth+1,1))'计算结束日期
if intendweekday=1 then
intendweekday=8
end if
datenddate=dateserial(intYear,intMonth+1,9-intendweekday)
intweek=0
for i= datinitdate to datenddate
if weekday(i)=2 then
Response.Write "<tr>"
response.write "<td width='12%' align='center' bgcolor=snow >"
response.write "<a target='listFrame' href=arrangelist.asp?type=week&year=" & intyear & "&month="& intmonth & "&day=" & day(i) & ">"
if cint(month(i))< cint(intmonth) then
response.write month(i) & "月第4周安排"
elseif cint(month(i))> cint(intmonth) then
response.write month(i) & "月第1周安排"
else
intweek=intweek+1
response.write month(i) & "月第" & intweek & "周安排"
end if
response.write "</a>"
response.write "</td>"
end if