Initialize a time span to 14 days
Module ToString
Public Sub Main()
Dim span As TimeSpan
span = New TimeSpan(-14, 0, 0, 0, 0)
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