I'm trying to convert a date string in one format into another. However, I get this exception error message
String was not recognized as a valid DateTime.
My code is as follows:
string theDate = "28-Feb-13 4:00:00 PM";
DateTime tempDate = DateTime.ParseExact(theDate, "dd-MMM-yy hh:mm:ss tt", CultureInfo.InvariantCulture, DateTimeStyles.None);
convertedDate = tempDate.ToString("yyyy/MM/dd hh:mm:ss");
I seriously have no idea what went wrong.