views:

1113

answers:

2

I'm trying to pull a DateTime object from RSS feeds in C# and DateTime.Parse(string) was working fine for the BBC rss feed which has a format like: Thu, 24 Sep 2009 13:08:30 GMT

But when I try and use that for Engadget's feed which has a date format like Thu, 24 Sep 2009 17:04:00 EST throws a FormatException.

Is there something straight forward that I'm missing here?

+2  A: 

DateTime.Parse doesn't understand EST. It only understands GMT on the end of the string.

Standard Date and Time Format Strings Link: http://msdn.microsoft.com/en-us/library/az4se3k1.aspx

Here's an SO link to help... EST and such are not recognized. You will have to convert them to the time offsets:

http://stackoverflow.com/questions/241789/parse-datetime-with-timezone-of-form-pst-cest-utc-etc

klabranche
+1. I missed that.
David Stratton
+1  A: 

Parsing dates in RSS feeds is VERY frustrating. I came across a fantastic free library called the Argotic Syndication Framework on CodePlex. It works like a champ and also supports ATOM feeds. Returns a nice little dataset from a feed, including a standard date.

Mike