how do i make the following a valid date?
class Program
{
static void Main(string[] args)
{
DateTime testResult;
DateTime.TryParse("31/1/2012", out testResult);
}
}
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.
Use this overload:
http://msdn.microsoft.com/en-us/library/9h21f14e.aspx
Pass a culture that specifies a DMY date order.
Example:
Some will suggest using TryParseExact, but that also requires you to specify a culture: