I have a string 12012009
input by the user in ASP.NET MVC application. I wanted to convert this to a DateTime
.
But if I do DateTime.TryParse("12012009", out outDateTime);
it returns a false.
So I tried to convert 12012009 to 12/01/2009 and then do
DateTime.TryParse("12/01/2009", out outDateTime);
which will work
But I don't find any straight forward method to convert string 12012009 to string "12/01/2009". Any ideas?