Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: REBOL Script to convert REBOL format to RSS XML

From: premshree::pillai::gmail::com at: 1-Jan-2005 0:43

On Fri, 31 Dec 2004 09:51:16 -0700, Gregg Irwin <greggirwin-mindspring.com> wrote:
> Hi Premshree, > > PP> Some rework may be required for the pubDate, though. The to-idate > PP> returns something like "Thu, 30 Dec 2004 0:00 +0000". For it to be > PP> validated, it must be "Thu, 30 Dec 2004 00:00:00 +0000". The change is > PP> required in the time, that is. It's a minor problem, though. > > TO-IDATE should probably be fixed then, if RFC822 is the spec it's > targeting. How about this for a quick patch?
Looks good! I haven't checked the specs of the RFC-822 completely, but, yes if any of the number is has a single digit, it should be prepended by a "0" (zero). One minor correction needed, though. The date/day should also go through the form-num function. So maybe the form-num function could be made global. I have reproduced Gregg's script along with the minor changes: form-num: func [num] [either 1 = length? num: form num [join #"0" num] [num]] to-itime: func [ "Returns a standard internet time string (two digits for each segment)" time [time!] ][ rejoin [form-num time/hour ":" form-num time/minute ":" form-num time/second] ] to-idate: func [ "Returns a standard Internet date string." date [date!] /local str ][ str: form date/zone remove find str ":" if (first str) <> #"-" [insert str #"+"] if (length? str) <= 4 [insert next str #"0"] head insert str reform [ pick ["Mon," "Tue," "Wed," "Thu," "Fri," "Sat," "Sun,"] date/weekday form-num date/day pick ["Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" Oct "Nov" "Dec"] date/month date/year to-itime date/time "" ] ]
> to-itime: func [ > "Returns a standard internet time string (two digits for each segment)" > time [time!] > /local form-num > ][ > form-num: func [num] [either 1 = length? num: form num [join #"0" num] [num]] > rejoin [form-num time/hour ":" form-num time/minute ":" form-num round time/second] > ] > > to-idate: func [ > "Returns a standard Internet date string." > date [date!] > /local str > ][ > str: form date/zone > remove find str ":" > if (first str) <> #"-" [insert str #"+"] > if (length? str) <= 4 [insert next str #"0"] > head insert str reform [ > pick ["Mon," "Tue," "Wed," "Thu," "Fri," "Sat," "Sun,"] date/weekday > date/day > pick ["Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec"] date/month > date/year to-itime date/time "" > ] > ] > > -- Gregg > > -- > To unsubscribe from the list, just send an email to rebol-request > at rebol.com with unsubscribe as the subject. >
-- Premshree Pillai http://www.livejournal.com/~premshree