Your error message does not relate to that code:
String not recognized as a valid datetime
Means that somewhere, a string is being converted to a DateTime, not converted from a DateTime to a string.
Start with the debugger, and look at the code that generates the exception - the chances are it's something like
Convert.ToDateTime
, and you need to look at exactly what the string you are trying to convert contains. When you find it, change the code to use DateTime.TryParse or even DateTime.TryParseExact and report or log errors when they occur.
We can't do that for you - the chances are the error comes from a database or similar, and we have no access to that or your other code.