I have a column of String variables in the following format: “dd-MMM-yyyy hh:mm AM/PM” (e.g. 17-MAR-2021 11:50 AM and 17-MAR-2021 01:17 PM). I need to cast this to a datetime variable.
I tried Datetime.ParseExact(row.Item(“VersionDate”).ToString,“dd-MMM-yyyy HH:mm”,System.Globalization.CultureInfo.InvariantCulture) but am getting an error that the string is not recognized as a valid datetime. Wondering if it has to do with the AM/PM at the end… any thoughts would be appreciated!