Module ToString
Public Sub Main()
Dim span As TimeSpan
' Initialize a time span to zero.
span = TimeSpan.Zero
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
|