'================================
' 定义待测日期
'================================
Dim dateTest As Date '待测日期
dateTest = "10/9/2009"
'================================
' 定义财年开始日期
'================================
Dim dateFY As Date '财年开始日期
Dim iDay As Integer 'FY开始日
Dim iMonth As Integer 'FY开始月
Dim iYear As Integer 'FY开始年
iDay = 1
iMonth = 10
iYear = DatePart("yyyy", dateTest ) '取待测日期年份作为待考查的财年
dateFY = iMonth & "/" & iDay & "/" & iYear
If dateFY > dateTest Then '如果待测日期小于财年开始日期,则跳到上一财年
dateFY = iMonth & "/" & iDay & "/" & (iYear - 1)
End If
'================================
' 计算日期间隔
'================================
Dim iBuffer As Integer 'FY非一周第一天始的间隔
Dim iDateRange As Integer '日期与FY第一天的间隔
iBuffer = DatePart("w", dateFY, vbSunday) '以周日为每周第一天
iDateRange = Abs(dateTest - dateFY) + iBuffer
'================================
' 得到周数
'================================
Dim iWeek As Integer 'FY中第几周
iWeek = -Int(-iDateRange / 7) '相当于向上取整