Associated Press RSS date

218 views Asked by At

I'm trying to parse the Associated Press RSS feed and the date is really confusing me. Here is an example of one item in the feed:

<entry>
    <id>urn:publicid:ap.org:Hosted2Syndication:b7f6d88749d341aa9a30e15dcb983b41</id>
    <title type="text">9/11 defendants ignore judge at Guantanamo hearing</title>
    <summary type="text">GUANTANAMO BAY NAVAL BASE, Cuba (AP) — They knelt in prayer, ignored the judge and wouldn't listen to Arabic translations as they confronted nearly 3,000 counts of murder. The self-proclaimed mastermind of the Sept. 11 attacks and four co-defendants defiantly disrupted an arraignment that dragged into Saturday night in the opening act of the long-stalled effort to prosecute them in a military court.</summary>
    <published>2012-05-05T22:38:59-04:00</published>
    <updated>2012-05-05T20:28:08-04:00</updated>
    <author />
    <link rel="alternate" type="text/html" title="AP Article" href="http://hosted2.ap.org/APDEFAULT/3d281c11a96b4ad082fe88aa0db04305/Article_2012-05-05-Guantanamo-Sept%2011%20Trial/id-b7f6d88749d341aa9a30e15dcb983b41" />
    <content type="xhtml"></content>
</entry>

So the published date is: 2012-05-05T22:38:59-04:00

If you view this item in your browser, the date is being displayed as: May. 5, 2012 8:28 PM ET

When I convert it to a date in code, however:

DateTime date;

DateTime.TryParse("2012-05-05T22:38:59-04:00", out date);

It's coming out as: 5/5/2012 10:38:59 PM

I don't know why the website's displayed date is 2 hours different.

You can probably see the difference with any item in the current feed:

http://hosted2.ap.org/atom/APDEFAULT/3d281c11a96b4ad082fe88aa0db04305

1

There are 1 answers

1
nvuono On BEST ANSWER

You are correctly seeing the <updated>2012-05-05T20:28:08-04:00</updated> date/time in the article when you load the actual story as May. 5, 2012 8:28 PM ET

20:28:08 (GMT-4) == 8:28 PM (ET)

Your C# code is fine but you'll have to ask the AP why the article was last updated two hours before it was actually published.