XML technologies / RSS & Atom / RSS 2.0 / RSS 2.0 elements for rich metadata / Data: time and update information
(Excerpt from "Newsfeeds with RSS and Atom" by Heinz Wittenbrink, published by Galileo Press, 2005)
Apart from the title and the content of item elements, probably no information in a newsfeed is as important to users as dates. Dated feeds and entries can be sorted chronologically and filtered to show only new or changed ones. Without an entry date, a reader or user cannot determine whether an item was just published or is months or years old.
An update date may also matter. It allows searches specifically for updated feeds and entries, and previously viewed items can reappear when updated.
Publication dates are addressed by the elements pubDate and lastBuildDate. They have belonged to RSS since version 0.91. (The three elements skipHours, skipDate and ttl concern aggregator-specific requirements and are discussed separately.)
The RSS 2.0 date format
One distinctive feature of RSS 2.0 and its predecessors is the date format. Dates must follow RFC 822. RFC 822 is an old standard from the Internet’s early days. The rationale appears in another document: RFC 822 is widespread because email uses it for dates, and is human-readable. The document also notes, almost apologetically, that the decision was made back in 1997. For the resulting development problems, see Lance Hunt’s article "Date Time Best Practices & RSS".
How are RFC 822 dates formed?
Two examples illustrate the format:
Tu, 2 Feb 2005 08:15:48 +0100
Tu, 2 Feb 05 07:15:48 GMT
The date begins with the weekday, using an English abbreviation Mon, Tue, Wed, Thu, Fri, Sat or Sun. Next come the day of the month, one or two digits, and an English abbreviation for the month (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec). The year may use two or four digits, preferably four. Hours, minutes, and seconds each use two digits separated by colons. The GMT offset may use four digits for hours and minutes, or a zone may be named: UT, GMT, EST, EDT, CST, CDT, MST, MDT, PST, PDT. The weekday and seconds may be omitted.
The pubDate element
The author should determine the date specified in pubDate. pubDate serves the role of a publication date in print or a date beside a signature. It should not change between updates or versions of a feed or entry. Both a whole feed and individual items may have publication dates. If an element item omits pubdate, the channel’s publication date applies.
The specification notes, for example, that the New York Times changes its new articles’ publication date every 24 hours. pubDate therefore does not record a feed’s actual creation date.
The publication date of a channel or item may differ from the displayed date. A feed reader may convert it according to the user’s system time, requiring a correct time zone in the feed. Often the reader simply shows when the information was first downloaded.
The specification explicitly permits future publication dates. A future date should delay display of the item until then, so-called scheduled publishing.
The following example specifies the time zone in two different ways.
<channel>
<pubDate>Tu, 2 Feb 2005 08:15:48 +0100</pubDate>
...
<item>
<pubDate>Tu, 2 Feb 2005 07:15:48 GMT</pubDate>
...
</item>
</channel>
Code example: using pubDate
For pubDate see also the page The pubDate element in the RSS 2.0 reference.
The lastBuildDate element (child of channel)
The date in lastBuildDate refers to the latest version of the channel itself, the RSS document. The specification is again ambiguous, referring to when the channel content was "last generated". It may differ substantially from the publication date because RSS can describe older content.
RSS 1.0 uses the Dublin Core vocabulary for dates, without distinguishing publication and latest-version dates, although feed creation time should be available in the HTTP header. The date string follows the ISO standard ISO 8601. Since RSS 2.0 allows extensions through namespaces, it can also use the Dublin Core element date instead of the RSS 2.0 element lastBuildDate in an RSS 2.0 document. For lastBuildDate see also the page The lastBuildDate element in the RSS 2.0 reference.
Generated time information
Every feed carries implicit timing information. In addition to dates in the document, software can use retrieval time. HTTP headers also report when a document became available and was modified. Since clients often process only this information, dates displayed by a newsreader may differ from those in the feed.

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.