intertwingly

It’s just data

Patch for Jon


Jon Udell is Experimenting with RSS 2.0.  I really like his new feed, though I think that the <docs> and <dc:date> elements need to be updated.  The Dublin Core defines dates as a profile of ISO 8601.  There probably are better fixes than what I am about to suggest, but here is a relatively brute force means (most of the logic deals with formatting the time zone and padding):

date.get (adrpost^.when, @day, @month, @year, @hour, @minute, @second);

tz = date.getCurrentTimeZone() / 60;
if (tz < 0) {tzsign = '-'} else {tzsign = '+'};
tz = abs(tz);
tzh = tz / 60;
tzm = tz - tzh*60;

month = string.mid("0" + month, string.length(month), 2);
day = string.mid("0" + day, string.length(day), 2);
hour = string.mid("0" + hour, string.length(hour), 2);
minute = string.mid("0" + minute, string.length(minute), 2);
second = string.mid("0" + second, string.length(second), 2);
tzh = string.mid("0" + tzh, string.length(tzh), 2);
tzm = string.mid("0" + tzm, string.length(tzm), 2);

dcdate = year + "/" +month + "/" + day + "T" + hour + ":" + minute + ":" + second + tzsign + tzh + ":" + tzm;