Why i can't parse a string like this:
DateTime date = DateTime.ParseExact("23.02.2016 08:59:35",
"dd.MM.yyyy HH:mm:ss", CultureInfo.InvariantCulture);
It is throwing an exception
String was not recognized as a valid DateTime.
I really don't understand.
Use the yyyy-MM-ddTHH:mm:ss. SSS+/-HH:mm or yyyy-MM-ddTHH:mm:ss. SSSZ formats to specify dateTime fields. yyyy is the four-digit year.
There are some zero-width Unicode characters in your strings. If you remove them it will work:
DateTime.ParseExact("23.02.2016 08:59:35",
"dd.MM.yyyy HH:mm:ss", CultureInfo.InvariantCulture)
Beware beware the  
non-breaking-space it looks like a space but isn't. You might have one of these between your date and time.... Especially if your pulling from a html document...Ohh the pain, the pain. The non-breaking-space also gets treated as whitespace in a regex and pass through undetected.
text = text.Replace('\u00A0',' ');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With