ASP计算周开始和一年有多少周及某年第一周开始日期

mac2022-06-30  58

<% Temp_F=firstday(2006) response.Write Temp_F&"<br>" response.Write DateDiff("ww","2006-1-1","2006-12-31")&"<br>" '计算一年有多少天 Temp_N=getfst(2006,52) response.Write Temp_N&"<br>" %>

<%

'计算某年第一周开始日期 function firstday(inputyear)  for i=cdate(inputyear&"-1-1") to cdate(inputyear&"-1-7")   if weekday(i)=2 then    firstday=i    exit for   end if  next end function

'计算输入日期是该年第几周的函数 Function CalcWeekNo(InputDate)  toyear=year(inputdate)  fday=firstday(toyear)  if datediff("d",fday,inputdate)<0 then   fday=firstday(toyear-1)  end if  'calcweekno=fday  daynum=datediff("d",fday,inputdate)  calcweekno=int(daynum/7) 1 end function

'根据周数和年份,计算该周第一天 function getfst(inputyear,weekno)  fday=firstday(inputyear)  getfst=dateadd("d",(weekno-1)*7,fday) end function %>

转载于:https://www.cnblogs.com/antony1029/archive/2008/02/17/1071609.html

最新回复(0)