Parse string to Date with g format and fr-FR culture
Imports System.Globalization
Module MainClass
Public Sub Main()
Dim dateString, format As String
Dim result As Date
Dim provider As CultureInfo = CultureInfo.InvariantCulture
dateString = "15/06/2010 08:30"
format = "g"
provider = New CultureInfo("fr-FR")
Try
result = Date.ParseExact(dateString, format, provider)
Console.WriteLine("{0} converts to {1}.", dateString, result.ToString())
Catch e As FormatException
Console.WriteLine("{0} is not in the correct format.", dateString)
End Try
End Sub
End Module
Related examples in the same category