String to datetime
Posted
by SARAVAN
on Stack Overflow
See other posts from Stack Overflow
or by SARAVAN
Published on 2010-05-10T18:46:40Z
Indexed on
2010/05/10
18:54 UTC
Read the original article
Hit count: 335
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?
© Stack Overflow or respective owner