I write the following code to convert a string to Date time but i am getting an exception so can any one help me
string str = "2/30/2011";
DateTime dt = DateTime.ParseExact(str, "yyMMdd", CultureInfo.InvariantCulture);`
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Other than the non-existing date? February 30th is not a date unless you’re using MySQL…
Oh, and of course, your format is wrong. It should be
M/dd//yyyy(because that’s how your string is formatted).