Seconds to time funktion
Jegf har lavet en funktion, som virker, men den giver forkert ved indput af sekunder på 4 eller 2 eller 1, hvor output bliver fx 08:00.Nogen der ved hvad er galt. Man ka sikert lave en smartere funktion...
Function SecondsToTime(ByVal SecondsX)
secondsToTime0 = SecondsX/60
If InStr(secondsToTime0,",") Then
secondsToTimeMinutePart0 = left(secondsToTime0,InStr(secondsToTime0,",")-1)
Else
secondsToTimeMinutePart0 = secondsToTime0
End If
If Len(secondsToTimeMinutePart0) = 1 Then
secondsToTimeMinutePart = "0" & secondsToTimeMinutePart0
Else
secondsToTimeMinutePart = secondsToTimeMinutePart0
End If
If InStr(secondsToTime0,",") Then
secondsToTimeSecondPart0 = mid(secondsToTime0,InStr(secondsToTime0,",")+1)
Else
secondsToTimeSecondPart0 ="00"
End If
secondsToTimeSecondPart0 = ("0," & secondsToTimeSecondPart0)*60
secondsToTimeSecondPart0 = Round(secondsToTimeSecondPart0)
If Len(secondsToTimeSecondPart0) = 1 Then
secondsToTimeSecondPart = "0" & secondsToTimeSecondPart0
Else
secondsToTimeSecondPart = secondsToTimeSecondPart0
End If
SecondsToTime = secondsToTimeMinutePart & ":" & secondsToTimeSecondPart
End Function