Imports System.Globalization
Module ParseDate
Public Sub Main()
Dim formattedDates() As String = { "2008-09-15T09:30:41.7752486-07:00", _
"2008-09-15T09:30:41.7752486Z", _
"2008-09-15T09:30:41.7752486", _
"2008-09-15T09:30:41.7752486-04:00", _
"Mon, 15 Sep 2008 09:30:41 GMT" }
For Each formattedDate As String In formattedDates
Console.WriteLine(formattedDate)
Dim roundtripDate As Date = Date.Parse(formattedDate, Nothing, _
DateTimeStyles.RoundtripKind)
Console.WriteLine(" With RoundtripKind flag: {0} {1} time.",roundtripDate, roundtripDate.Kind)
Dim noRoundtripDate As Date = Date.Parse(formattedDate, Nothing,DateTimeStyles.None)
Console.WriteLine(" Without RoundtripKind flag: {0} {1} time.",noRoundtripDate, noRoundtripDate.Kind)
Next
End Sub
End Module