I\'m using .NET 3.5 and I have a date that comes in as string in the following format:
Tue Jan 20 20:47:43 GMT 2009
First questi
There you go
DateTime d = DateTime.ParseExact("Tue Jan 20 20:47:43 GMT 2009".Replace("GMT", "+00"), "ffffd MMM dd H:mm:ss zz yyyy", new CultureInfo("en-US"));
The DateTime API and its documentation pretty much sucks. Exceptions will only tell you that "String was not recognized as a valid DateTime", which doesn't really help. It had to figure out the date format specifiers myself because I didn't find them in MSDN.
The "en-US" locale is necessary, I guess, because your date format uses English abbreviations like "Tue".
Anyway, I can't tell you what the date format is called. It is pretty similar but not equal to a format used with HTTP (e.g. If-Modified-Since: Wed, 08 Dec 2004 13:25:25 GMT
).