vbscript asp - 查找每个星期四在一个特定的月份 [英] vbscript asp - Find every Thursday in a given month

查看:150
本文介绍了vbscript asp - 查找每个星期四在一个特定的月份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



任何人都可以帮助?

解决方案

这是一种方式;

  base_date = cdate(2011年8月21日 )

'获得第一个星期四;
thurs = dateserial(year(base_date),month(base_date),1)
if(weekday(thurs)1)then thurs = 5 - weekday(thurs)+ thurs

'循环后续;
直到月(thurs)<> month(base_date)
msgbox thurs
thurs = dateadd(d,7,thurs)
loop


I'm trying to find all Thursdays within a given Month using VBScript.

Can anyone help?

解决方案

Here is one way;

base_date = cdate("21 aug 2011")

'get 1st thursday;
thurs = dateserial(year(base_date), month(base_date), 1)
if (weekday(thurs) <> 1) then thurs = 5 - weekday(thurs) + thurs

'loop subsequent;
do until month(thurs) <> month(base_date)
    msgbox thurs
    thurs = dateadd("d", 7, thurs)
loop

这篇关于vbscript asp - 查找每个星期四在一个特定的月份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆