C# DateTime.ParseExact throwing format exception
- by Rob
I'm developing an .NET4 webapplication using MVC3.
Let's say i'm getting the following DateTime as string from an XML-feed. The xml feed is being read by my application and i'm looping through all it's descendants. The DateTime i'm receiving is begin returned in the following format (as string);
var myDateTime = "Sun Dec 19 11:45:45 +0000 2010"
I'm using the piece of code below to try and parse the DateTime string i mentioned above to a valid DateTime format (preferably dutch)
var CorrectDateTime = DateTime.ParseExact(myDateTime , "dd MMM yyyy HH:mm:ss", CultureInfo.InvariantCulture);
When trying to execute this code i'm facing an formatexception. Somebody has got any ideas?