Magic_Doctor
XLDnaute Barbatruc
J'en avais besoin, donc je l'ai fait. Mais je pense que l'on peut faire plus simple.
VB:
Function ConvertSeconds(sec#) As String
'Converti des desondes en années | jours | heures | minutes | secondes
'Magic_Doctor
Dim a#, j#, h As Byte, mn As Byte, s As Byte, suf1$, suf2$
j = Int(sec / 86400)
a = Int(j / 365)
h = Int((sec - j * 86400) / 3600)
mn = Int(((sec - j * 86400) / 3600 - h) * 60)
s = Int((((sec - j * 86400) / 3600 - h) * 60 - mn) * 60)
j = j - a * 365
suf1 = IIf(a = 0, "", IIf(a = 1, " an", " ans"))
suf2 = IIf(j = 0, "", IIf(j = 1, " jour", " jours"))
ConvertSeconds = IIf(a = 0, "", a & suf1 & " ") & IIf(j = 0, "", j & suf2 & " ") & IIf(h < 10, "0", "") & h & ":" & IIf(mn < 10, "0", "") & mn & ":" & IIf(s < 10, "0", "") & s
End Function