关于一个日期的问题 (在线等)

ech0yunyun 2004-01-13 09:25:12
代码如下
<%

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
...全文
29 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
jacklinchen 2004-01-13
  • 打赏
  • 举报
回复
这么多代码啊,您想要解决什么问题
xieyj 2004-01-13
  • 打赏
  • 举报
回复
都没说什么问题
ech0yunyun 2004-01-13
  • 打赏
  • 举报
回复
高手 你到 求助高手 (日历问题) 这个提问里面去帮我看看啊 我在里面写了什么问题

28,407

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧