Tuesday, 13 August 2013

Why can't I parse this string to date?

Why can't I parse this string to date?

I am trying to parse a string to a DateTime:
string datum = "13/7/2013";
DateTime dtDatum = DateTime.ParseExact(datum, "yyyy-d-M",
CultureInfo.GetCultureInfo("nl-NL"));
I'm getting "FormatException was unhandled by user code". I've tried
serveral formats, and also different CultureInfo's, but nothing seems to
work. I've searched on Google and this website, but can't seem to find an
answer that gets rid of the exception.
Help is much appreciated.

No comments:

Post a Comment