I have tried all combinations of DateTime.Parse and ParseExact and they don't work. I keep getting the message "{"String was not recognized as a valid DateTime."}" for both those functions. I have also tried Convert.ToDateTime and that don't work. Just to check if I wasn't dreaming, I wrote the following code:
Dim ExpiryDate As Date = System.DateTime.Now
Dim provider As New CultureInfo("en-US")
Try
Dim strDate As String = Convert.ToString(ExpiryDate)
ExpiryDate = DateTime.ParseExact(strDate, "mmddyy", provider)
Catch ex as exception
'ex here says "{"String was not recognized as a valid DateTime."}"
End Try
I just want to take string in this form mm-dd-yyyy or mm/dd/yyyy and convert it to a date so I can test (greater than) against another date. Any help appreciated.