I tried the following code:
DateTime dateTime = DateTime.ParseExact("01/02/2013",
"01/02/2013",
CultureInfo.InvariantCulture);
I know the format is incorrect. But why, instead of throwing an exception, the current date is returned dateTime = {24/09/2014 12:00:00 AM}.
I know that there should be a valid format for my date MM/dd/yyyy, but why didn’t he throw an exception. I also tried it with DateTime.TryParseExact, it returns the current date instead default(DateTime). It actually came to reading this question .
My question is, how does this parsing work?
source
share