I am using the DateTime.ParseExact method to parse a date-time. However, why does the following fail and throw an exception?
string input = "100206 2330";
string format = "ddMMyy hhmm";
DateTime parsed = DateTime.ParseExact(input, format, CultureInfo.InvariantCulture);
Judging from the Custom Date and Time Format Strings article on MSDN, the format is correct for this input string. I am very confused.
Thanks in advance,
Sterren
“hh” is a 12-hour clock hour specifier (01-12). You want “HH” to cope with “23”.