Function DifDate(début As Date, fin As Date) 'ROGER2327
Dim D As Date, F As Date, T&, Jo%, dH#, HMS As Variant
Application.Volatile
If début < fin Then D = début: F = fin + 1 Else D = fin: F = début + 1
dH = F - Int(F) - D + Int(D)
F = Int(F) + (dH < 0)
D = Int(D)
HMS = Split(Format(dH - (dH < 0), "h m s"))
T = 12 * (Year(F) - Year(D) - 1)
Do While DecMois(D, T + 4) < F: T = T + 4: Loop
Do While DecMois(D, T + 1) < F: T = T + 1: Loop
Jo = F - DateSerial(Year(DecMois(D, T)), Month(DecMois(D, T)), 1 + Day(DecMois(D, T)))
DifDate = Array(T \ 12, T Mod 12, Jo, CInt(HMS(0)), CInt(HMS(1)), CInt(HMS(2))) 'Renvoie un vecteur-ligne à six composantes.
End Function
Function DecMois(D As Date, dec&) As Date 'ROGER2327
Dim x, y
x = DateSerial(Year(D), Month(D) + dec, 1)
y = Day(DateSerial(Year(x), Month(x) + 1, 0))
DecMois = DateSerial(Year(D), Month(D) + dec, (y + Day(D) - Abs(y - Day(D))) / 2)
End Function