REBOL Programming/to-idate

From Wikibooks, open books for an open world
< REBOL Programming
Jump to: navigation, search

USAGE:[edit]

TO-IDATE date 

DESCRIPTION:[edit]

Returns a standard Internet date string.

TO-IDATE is a function value.

ARGUMENTS[edit]

  • date -- (Type: date)

SOURCE CODE[edit]

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"] 
    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 any [date/time 0:00] 
        str
    ]
]