I have this example and this gives me an exception. "Conversion from string x to dateTime is invalid"
here is my method of checking date and time.
Example Date String: "03/27/1985"
Public Function validateDateColumn(ByRef FieldName As String) As Boolean Try If IsDate(FieldName) Then Dim actualDate As DateTime = CDate(FieldName) Dim DtLicExp As DateTime = CDate(actualDate.ToString("d", Thread.CurrentThread.CurrentCulture)) FieldName = DtLicExp.ToString("MM/dd/yyyy") Return True End If Catch ex As Exception 'FieldName &= "Format must be MM/dd/yyyy" Return False End Try End Function
any idea for checking date string form for datetime.
I want to convert this date "27/03/1985" to datetime.
I am using asp.net with vb.net.
source share