Imports System.Globalization
Module Example
Public Sub Main( )
Dim cultureNames() As String = { "en-US", "ru-RU","ja-JP" }
Dim dateStrings() As String = { "01/02/09", "2010/02/03", "01/2010/03", _
"01/02/2010", "21/02/09", "01/22/09", _
"01/02/23" }
For Each cultureName As String In cultureNames
Dim culture As CultureInfo = New CultureInfo(cultureName)
For Each dateStr As String In dateStrings
Dim dateTimeValue As DateTime
Try
dateTimeValue = Convert.ToDateTime(dateStr, culture)
Console.WriteLine("{0,-18}{1,-12}{2:yyyy-MMM-dd}",dateStr, cultureName, dateTimeValue)
Catch e As FormatException
Console.WriteLine("{0,-18}{1,-12}{2}",dateStr, cultureName, e.GetType().Name)
End Try
Next
Next
End Sub
End Module