/ Published in: Other
Takes an integer value of frames (a) and converts it to a text formatted timecode "00:00:00:00" using the supplied framerate (b). Mainly for use in OpenOffice Calc.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Function FRAMESTOTC(a,b) Dim HrsStr, MinsStr, SecsStr, FramesStr as String Dim HrsFinalStr, MinsFinalStr, SecsFinalStr, FramesFinalStr as String Dim MinsInt, SecsInt, FramesInt as Integer Dim HrsInt as Long FramesInt = a mod b FramesStr = FramesInt If Len(FramesStr) = 1 Then FramesFinalStr = "0" & FramesStr Else FramesFinalStr = FramesStr End If SecsInt = ((a-FramesInt)/b) mod 60 SecsStr = SecsInt If Len(SecsStr) = 1 Then SecsFinalStr = "0" & SecsStr Else SecsFinalStr = SecsStr End If MinsInt = ((a-SecsInt*b-FramesInt)/(60*b)) mod 60 MinsStr = MinsInt If Len(MinsStr) = 1 Then MinsFinalStr = "0" & MinsStr Else MinsFinalStr = MinsStr End If HrsInt = ((a-MinsInt*b*60-SecsInt*b-FramesInt))/(60*60*b) mod 60 HrsStr = HrsInt If Len(HrsStr) = 1 Then HrsFinalStr = "0" & HrsStr Else HrsFinalStr = HrsStr End If FRAMESTOTC = HrsFinalStr & ":" & MinsFinalStr & ":" & SecsFinalStr & ":" & FramesFinalStr End Function