Sunday, 18 August 2013

Strange error when parsing string to date?

Strange error when parsing string to date?

When I try to parse date like this:
DateTime t1 = DateTime.ParseExact("August 11, 2013, 11:00:00 PM", "MMMM
dd, yyyy, hh:mm:ss tt",
System.Globalization.CultureInfo.InvariantCulture);
It works correctly but when I do thing like this :
string s ="ýAugust ý11, ý2013, þý11:00:00 PM";
DateTime t = DateTime.ParseExact(s, "MMMM dd, yyyy, hh:mm:ss tt",
System.Globalization.CultureInfo.InvariantCulture);
I get this error :
An exception of type 'System.FormatException' occurred in mscorlib.ni.dll
but was not handled in user code

No comments:

Post a Comment