Parse string to create new TimeSpan
Module MyModule
Public Sub Main()
Dim values() As String = { "12", "31.", "11.8:32:16", ".12"}
For Each value As String In values
Try
Dim ts As TimeSpan = TimeSpan.Parse(value)
Console.WriteLine("'{0}' --> {1}", value, ts)
Catch e As Exception
Console.WriteLine("Exception")
End Try
Next
End Sub
End Module
Related examples in the same category