Initalize a timespan to 25 milliseconds
Module ToString
Public Sub Main()
Dim span As TimeSpan
span = New TimeSpan(0, 0, 0, 0, 25)
Console.WriteLine(FormatTimeSpan(span))
End Sub
Private Function FormatTimeSpan(span As TimeSpan) As String
Dim sign As String = String.Empty
Return sign & span.Days.ToString("00") & "." & _
span.Hours.ToString("00") & ":" & _
span.Minutes.ToString("00") & ":" & _
span.Seconds.ToString("00") & "." & _
span.Milliseconds.ToString("000")
End Function
End Module
Related examples in the same category