Function DuréeEnClair(ByVal DuRest As Double, Optional ByVal OPé As Long = -1) As String
Dim U As Long, DuUnit As Double, NbUnit As Long, Trad As String, Compter As Boolean, K As Long
For U = 1 To 6
If DuRest = 0 Then Exit For
If OPé > 0 And U > OPé Then Exit For
DuUnit = Choose(U, 365.2425, 30.436875, 7, 1, 1 / 24, 1 / 1440)
NbUnit = Int(DuRest / DuUnit)
If NbUnit > 0 Then
If OPé <= 0 Then Compter = True
If Trad <> "" Then
If DuréeEnClair <> "" Then
DuréeEnClair = DuréeEnClair & ", " & Trad
Else
DuréeEnClair = Trad: End If
End If
Trad = NbUnit & " " & Choose(U, "an", "mois", "sem.", "jour", "heure", "min")
If NbUnit * Choose(U, 1, 0, 0, 1, 1, 0) > 1 Then Trad = Trad & "s"
DuRest = DuRest - DuUnit * NbUnit: End If
If Compter Then K = K - 1: If K < OPé Then Exit For
Next U
If Trad <> "" Then
If DuréeEnClair <> "" Then
DuréeEnClair = DuréeEnClair & " et " & Trad
Else
DuréeEnClair = Trad: End If
End If
If OPé > 0 And DuréeEnClair = "" Then DuréeEnClair = "Moins d'1 " _
& Choose(OPé, "an", "mois", "sem.", "jour", "heure", "min")
End Function