小算法#xff1a;如何判断当前日期是第几周#xff1f;
mydate, to xinxian1366() 非常感谢您真是太伟大了向你学习 我费了半天劲儿在你的基础上也做出来了,vbMonday)1 then 应是上月的最后一周 计算上月月数 if month(mydate)1 then lastmonth12 else lastmonthmonth(mydate)-1 end if lastmonthFirst year(mydate) - lastmonth -1 上月1日日期 Week3 DatePart(ww,vbMonday)1 then myweekmyweek-1 显示本周的上一周 else myweekmyweek end if if myweek0 and Weekday(monthFirst,vbMonday)1 then myweekmyweek-1 显示本月的上一周 mymonthlastmonth end if response.Write 第cstr(myweek)周br response.Write 第cstr(mymonth)月br % ,vbMonday)本月1日是一年的第几周 myweek week1-week21 如果本月1日是周一则直接显示为上周最后一周但算出的周就是正确的周 否则周数要减1显示本周的上一周 if Weekday(monthFirst,vbMonday) 上月1日是一年的第几周 取得上个月的天数 lasttotaldaysDateDiff(d。
monthFirst , % myDatedate() myMonth month(mydate)所需月份值 monthFirst year(mydate) - month(mydate) -1本月1日日期 Week1 DatePart(ww,lastmonthfirst,lastmonthFirst 。
vbMonday)今天是一年的第一周 Week2 DatePart(ww,monthfirst) 取得上个月最后一天的日期 lastmonthlastday year(mydate) - lastmonth - lasttotaldays response.write 上月最后一天日期为lastmonthlastdaybr Week4 DatePart(ww,lastmonthlastday ,。
vbMonday) 上月最后1天是一年第几周 response.write 上月最后一天为一年中第cstr(week4)周br myweek week4-week31 if Weekday(lastmonthFirst。
但比较麻烦。
- 上一篇:EXCEL中如何通过日期计算是第几周
- 下一篇:怎么看今天是第几周
评论列表