Module ToString
Public Sub Main()
Dim span As TimeSpan
span = New TimeSpan(99, 23, 59, 59, 999)
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
|