Her er de jeg har lavet, og som fungerer, men sikkert kan laves smartere:
Function TimeToSeconds(ByVal TimeX) If Len(TimeX) = 8 Then minutePartTimeToSeconds = mid(timeX,4,2) * 60 secondPartTimeToSeconds = mid(timeX,7) Else minutePartTimeToSeconds = mid(timeX,1,2) * 60 secondPartTimeToSeconds = mid(timeX,4) End If TimeToSeconds = minutePartTimeToSeconds+secondPartTimeToSeconds End Function
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
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.