I thought this would be a really simple, and i\'ve tried to google it and I keep getting the exception String was not recognized as a valid DateTime.
This i
You don't need the ParseExact
method, the Parse
method is sufficient because it allows your date representation. See DateTime - The string to parse for an overview of allowed input formats.
This means the following works:
string sample = "2013-10-21T14:10:49";
DateTime parsed = DateTime.Parse(sample);
Console.WriteLine(parsed.ToString("MM/dd/yyyy HH:mm:ss"));
And the result is:
10/21/2013 14:10:49