1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
Public Sub Test4()
i2 = 1900
For i = 1900 To 2100 'années
For k = 29 To 31 '29, 30 ou 31 décembre
Dte = DateSerial(i, 12, k)
intNoSem = DatePart("ww", Dte, vbMonday, vbFirstFourDays)
intNoJour = DatePart("w", Dte, vbMonday, vbFirstFourDays)
If intNoSem = 53 Then
If (k = 29 And intNoJour = 1) _
Or (k = 30 And (intNoJour = 1 Or intNoJour = 2)) _
Or (k = 31 And (intNoJour = 1 Or intNoJour = 2 Or intNoJour = 3)) Then
'Debug.Print Dte & " - " & DatePart("ww", Dte, vbMonday, vbFirstFourDays) & " - " & DatePart("w", Dte, vbMonday, vbFirstFourDays) & " - Delta=" & i - i2
Debug.Print Format(Dte, "yyyy/mm/dd") & " - " & DatePart("ww", Dte, vbMonday, vbFirstFourDays) & " - " & DatePart("w", Dte, vbMonday, vbFirstFourDays) & " - Delta=" & i - i2
i2 = i
End If
End If
Next k
Next i
End Sub |
Partager