Possible Duplicate:
Parse Datetime string
I’m trying to parse the following DateTime in C#:
string date = "Wed Jul 25 19:41:36 2012 +0200"
DateTime result = DateTime.Parse(date);
And I’m getting the following error:
System.FormatException : String was not recognized as a valid DateTime.
Anybody knows what is the problem here?
You can use
DateTime.ParseExact()for that. For exampleUPDATED:
Documentation Here and
DateTimestring formatting options here.You can also view here {Complr.com}