CONVERSION DES SECONDES EN FORMAT HH/MM/SS

YannGotti Messages postés 36 Date d'inscription samedi 29 mars 2003 Statut Membre Dernière intervention 29 décembre 2010 - 12 avril 2004 à 12:03
YannGotti Messages postés 36 Date d'inscription samedi 29 mars 2003 Statut Membre Dernière intervention 29 décembre 2010 - 12 avril 2004 à 12:03
Cette discussion concerne un article du site. Pour la consulter dans son contexte d'origine, cliquez sur le lien ci-dessous.

https://codes-sources.commentcamarche.net/source/21755-conversion-des-secondes-en-format-hh-mm-ss

YannGotti Messages postés 36 Date d'inscription samedi 29 mars 2003 Statut Membre Dernière intervention 29 décembre 2010 1
12 avril 2004 à 12:03
Hello!...

Ton code est pas mal mais il n'était pas compatible avec ce que je voulais faire alors je l'ai un peut modifié...

Private Function SToHMS(ByVal Seconds As Long) As String
If Seconds < 60 Then
SToHMS = "00:00:" & Format(Seconds, "0#")
Exit Function
End If

Var1 = Int(Seconds / 60)
Var2 = Seconds - (Var1 * 60)

If Var1 >= 60 Then
Var3 = Int(Var1 / 60)
Var4 = Var1 - (Var3 * 60)
SToHMS = Format(Var3, "0#") & ":" & Format(Var4, "0#") & ":" & Format(Var2, "0#")
Else
SToHMS = "00" & ":" & Format(Var1, "0#") & ":" & Format(Var2, "0#")
End If
End Function

Ton code renvoyais 0:1:30 quand on convertis 90, maintenan il renvoye 00:01:30
Rejoignez-nous