to homepage
 Weekly emails: how to advanced search
 Glossary lookup:


> how to > AppSwitching diary

Sunday, April 20, 2003

Date and time formats in RSS 2.0

There are two main ways of timestamping an item in an RSS 2.0 feed. You can either use the <pubDate> tag specified in Dave Winer's RSS 2.0 specification, or you can use the <dc:date> tag from the Dublin Core schema. They have identical meanings. But they use different timestamp formats.

RSS 2.0 <pubDate> uses the date and time format defined in RFC # 822, a standard for internet messages that dates from 1982 (but using 4 digits for the year instead of the two specified in the original, pre-Y2K document). This is a very natural format, rendering timestamps as, for example, "Sat, 19 Apr 2003 23:40:26 GMT". Dublin Core's <dc:date>, on the other hand, uses a W3C submission based on ISO 8601, the International Standard for the representation of dates and times. This format is not as user-friendly, rendering the same example as "2003-04-19T23:40:26-00:00". For some reason, PHP's strtotime() function doesn't parse it, either, so if you or your subscribers are going to want to read the timestamp using PHP, you'll save them some trouble if you use <pubDate> instead.

Whichever you use, bear in mind that the timestamp provided can be either the creation date or the availability date (ie the publication date), which might be a date in the future rather than the past. The same tags may also be used in the <channel> element of the feed. Here, they are usually taken as being when the feed was last modified, but that's not formally required. Oddly, there's no commonly accepted tag for marking 'last modified' for items where it makes sense to record this information in addition to a 'first published' timestamp (for example in a feed of glossary definitions). Which just goes to show some of the difficulties you get into when you start trying to do really meaningful semantic markup.

PS: This is the first of the occasional articles and tips I mentioned in my previous posting, although the redesign I mentioned there is still pending at the moment. It seemed like a good idea to publish this anyway, since the information doesn't seem to be easily available anywhere else on the Web. I'm glad to see that there are moves afoot to put forward RSS 2.0 as a submission to the IETF, and I hope that will also encourage the emergence of readily available best-practice guidance that people can turn to when developing practical implementations.

posted by Phil 5:40 AM (GMT) | comments | link

Building a website using plug-in online services: the Loosely Coupled experience

read an RSS feed from this weblog



Loosely Coupled weblog RSS source


Copyright © 2002-2006, Procullux Media Ltd. All Rights Reserved.