[br]<% [br]y=request.querystring("y") [br]m=request.querystring("m") [br]d=request.querystring("d") [br][br]if y="" then [br] y=year(date) [br] m=month(date) [br] d=day(date) [br]end if [br][br]call blogdate(y,m,d) [br][br]'=====================以年月日为参数的显示============================================== [br]sub blogdate(y,m,d) ' [br]str1=" 当前的日期是"&y&"年"&m&"月"&d&"日 " '得到当前日期的年月日 [br]nowdate=y&"-"&m&"-"&d [br]lastdate=dateadd("m",-1,nowdate) [br]lasty=year(lastdate) [br]lastm=month(lastdate) [br]nextdate=dateadd("m",1,nowdate) [br]nexty=year(nextdate) [br]nextm=month(nextdate) [br]str1=str1&"
上一月 " [br]str1=str1&"
下一月 " [br]str1=str1&"
返回今日" [br]response.write str1 [br]thismonth=y&"-"&m&"-1" '当前月的第一天 [br]nextmonth=dateadd("m",1,thismonth) '下个月的第一天 [br]num=datediff("d",thismonth,nextmonth) '当前月的天数 [br]firstday=weekday(thismonth)-1 '得到当前月第一天的星期 [br]'call displaydate(firstday,num) [br]response.write "
" & vbcrlf [br]response.write "" & vbcrlf [br]response.write "星期日 | " & vbcrlf [br]response.write "星期一 | " & vbcrlf [br]response.write "星期二 | " & vbcrlf [br]response.write "星期三 | " & vbcrlf [br]response.write "星期四 | " & vbcrlf [br]response.write "星期五 | " & vbcrlf [br]response.write "星期六 | " & vbcrlf [br]response.write "
" & vbcrlf [br]'需要参数:当前月第一天的星期firstday,当前月的天数num [br]for n=1 to 6 [br]response.write "" [br] for i=1 to 7 [br] thisday=0 [br] if i>firstday then thisday=i-firstday [br] if n>1 then thisday=7*(n-1)+i-firstday [br] if thisday>num then thisday=0 [br] if thisday=0 then [br] display=" " [br] else [br] display=""&thisday&"" [br] end if [br] response.write ""&display&" | " [br] next [br] if n=5 and (thisday=num or thisday=0) then n=n+1 [br]response.write "
" [br]next [br]response.write "
" & vbcrlf [br]end sub [br]'=================================================================== [br]%>
[code]
<%
y=request.querystring("y")
m=request.querystring("m")
d=request.querystring("d")
if y="" then
y=year(date)
m=month(date)
d=day(date)
end if
call blogdate(y,m,d)
'=====================以年月日为参数的显示==============================================
sub blogdate(y,m,d) '
str1=" 当前的日期是"&y&"年"&m&"月"&d&"日 " '得到当前日期的年月日
nowdate=y&"-"&m&"-"&d
lastdate=dateadd("m",-1,nowdate)
lasty=year(lastdate)
lastm=month(lastdate)
nextdate=dateadd("m",1,nowdate)
nexty=year(nextdate)
nextm=month(nextdate)
str1=str1&"
上一月 "
str1=str1&"
下一月 "
str1=str1&"
返回今日"
response.write str1
thismonth=y&"-"&m&"-1" '当前月的第一天
nextmonth=dateadd("m",1,thismonth) '下个月的第一天
num=datediff("d",thismonth,nextmonth) '当前月的天数
firstday=weekday(thismonth)-1 '得到当前月第一天的星期
'call displaydate(firstday,num)
response.write "
" & vbcrlf
response.write "" & vbcrlf
response.write "星期日 | " & vbcrlf
response.write "星期一 | " & vbcrlf
response.write "星期二 | " & vbcrlf
response.write "星期三 | " & vbcrlf
response.write "星期四 | " & vbcrlf
response.write "星期五 | " & vbcrlf
response.write "星期六 | " & vbcrlf
response.write "
" & vbcrlf
'需要参数:当前月第一天的星期firstday,当前月的天数num
for n=1 to 6
response.write ""
for i=1 to 7
thisday=0
if i>firstday then thisday=i-firstday
if n>1 then thisday=7*(n-1)+i-firstday
if thisday>num then thisday=0
if thisday=0 then
display=" "
else
display=""&thisday&""
end if
response.write ""&display&" | "
next
if n=5 and (thisday=num or thisday=0) then n=n+1
response.write "
"
next
response.write "
" & vbcrlf
end sub
'===================================================================
%>
[/code]
该文章在 2010/7/22 10:55:31 编辑过