Permalink
Cannot retrieve contributors at this time
Fetching contributors…
| ' Visual Basic .NET Document | |
| Option Strict On | |
| ' <Snippet2> | |
| Module Example | |
| Public Sub Main() | |
| Dim value As String = Nothing | |
| Dim interval As TimeSpan | |
| value = "6" | |
| If TimeSpan.TryParseExact(value, "%d", Nothing, interval) Then | |
| Console.WriteLine("{0} --> {1}", value, interval.ToString("c")) | |
| Else | |
| Console.WriteLine("Unable to parse '{0}'", value) | |
| End If | |
| value = "16:32.05" | |
| If TimeSpan.TryParseExact(value, "mm\:ss\.ff", Nothing, interval) Then | |
| Console.WriteLine("{0} --> {1}", value, interval.ToString("c")) | |
| Else | |
| Console.WriteLine("Unable to parse '{0}'", value) | |
| End If | |
| value= "12.035" | |
| If TimeSpan.TryParseExact(value, "ss\.fff", Nothing, interval) Then | |
| Console.WriteLine("{0} --> {1}", value, interval.ToString("c")) | |
| Else | |
| Console.WriteLine("Unable to parse '{0}'", value) | |
| End If | |
| End Sub | |
| End Module | |
| ' The example displays the following output: | |
| ' 6 --> 6.00:00:00 | |
| ' 16:32.05 --> 00:16:32.0500000 | |
| ' 12.035 --> 00:00:12.0350000 | |
| ' </Snippet2> | |