|
请参考如下函数:
Function SE(sDay As Date, eDay As Date)
Dim intTotalDays As Integer '总天数
Dim intWeekendDays As Integer '总周六、日天数
'SE总工作日天数=总天数-总周六、日天数
Select Case DatePart("w", sDay, vbMonday)
Case Is = 6
sDay = DateAdd("d", sDay, 2)
Case Is = 7
sDay = DateAdd("d", sDay, 1)
End Select
Select Case DatePart("w", eDay, vbMonday)
Case Is = 6
eDay = DateAdd("d", eDay, -1)
Case Is = 7
eDay = DateAdd("d", eDay, -2)
End Select
intTotalDays = DateDiff("d", sDay, eDay) + 1
intWeekendDays = DateDiff("ww", sDay, eDay, vbMonday) * 2
SE = intTotalDays - intWeekendDays
End Function |
|