Function NumeroSemaine(ByVal DDate As Date) As Integer
Dim n As Integer
n = Int((DDate - DateSerial(Year(DDate), 1, 1) + ((Weekday(DateSerial(Year(DDate), 1, 1)) + 1) Mod 7) - 3) / 7) + 1
If n = 0 Then
n = NumeroSemaine(DateSerial(Year(DDate) - 1, 12, 31))
ElseIf n = 53 And (Weekday(DateSerial(Year(DDate), 12, 31)) - 1) Mod 7 <= 3 Then
n = 1
End If
NumeroSemaine = n
End Function
Function NSem(ByVal ddate As Date) As Integer
Dim t As Long
t = DateSerial(Year(ddate + (8 - Weekday(ddate)) Mod 7 - 3), 1, 1)
NSem = ((ddate - t - 3 + (Weekday(t) + 1) Mod 7)) \ 7 + 1
End Function
Function NumSem(ByVal D As Date) As Integer
NumSem = DatePart("ww", D, vbMonday, vbFirstFourDays)
End Function
|