Function DDate1(ByVal D As Date, ByVal F As Date)
'Version sans les heures, minutes, secondes (similaire à EcartDate de Roland_M)
Dim t&, Jo%
F = Int(F) - (Round(F - Int(F) - D + Int(D), 6) >= 0)
t = 12 * (Year(F) - Year(D)) + Month(F) - Month(D)
t = t + (DecMois(D, t) >= F)
Jo = F - DecMois(D, t) - 1
DDate1 = Array(t \ 12, t Mod 12, Jo) 'Renvoie un vecteur-ligne à trois composantes.
End Function
Function DecMois(D As Date, dec&) As Long
Dim x&, y&
x = DateSerial(Year(D), Month(D) + dec, 1)
y = Day(DateSerial(Year(x), Month(x) + 1, 0))
If y < Day(D) Then DecMois = x + y - 1 Else DecMois = x + Day(D) - 1
End Function