Why does the following code generate a FormatException?
DateTime.ParseExact("03/01/2012", "dd/MM/yyyy", null);

Perhaps it has something to do with the fact that the code is running under IIS 7.5 Express as a part of an MVC3 site execution logic?
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.
You need to include CultureInfo, for example:
Slashes in format string are culture sensitive and if you don’t pass in CultureInfo, current culture is used. You can also use
CultureInfo.InvariantCultureand it will work. Jon Skeet provides some detailed explanation here.