asp实现本周的一周时间列表的代码


复制代码 代码如下:

td=date()
'此次为设置当前日期,主要是为了调试方便,实际应用中可以使用当天日期..
str="一二三四五六日"
'生成具体是周几的串,根据位置来取就可以了..
for x=1 to 7
'这个循环主要是判断是最近的周一是哪天就可以了...
if td-weekday(td)+1+x=td then
'这个判断是要让当前日期显示红色,没什么特别的价值..
response.write "<font color=red>周"&mid(str,x,1)&":"&FormatDateTime(td-weekday(td)+1+x,1)&"</font><br>"
else
response.write "周"&mid(str,x,1)&":"&FormatDateTime(td-weekday(td)+1+x,1)&"<br>"
end if
next

复制代码 代码如下:
td=date()
'此次为设置当前日期,主要是为了调试方便,实际应用中可以使用当天日期..
str="一二三四五六日"
'生成具体是周几的串,根据位置来取就可以了..
for x=1 to 7
'这个循环主要是判断是最近的周一是哪天就可以了...
if td-weekday(td)+1+x=td then
'这个判断是要让当前日期显示红色,没什么特别的价值..
response.write "<font color=red>周"&mid(str,x,1)&":"&FormatDateTime(td-weekday(td)+1+x,1)&"</font><br>"
else
response.write "周"&mid(str,x,1)&":"&FormatDateTime(td-weekday(td)+1+x,1)&"<br>"
end if
next


« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3