Jump to content

Rebol Programming/to-idate

From Wikibooks, open books for an open world

USAGE:

[edit | edit source]
TO-IDATE date 

DESCRIPTION:

[edit | edit source]

Returns a standard Internet date string.

TO-IDATE is a function value.

ARGUMENTS

[edit | edit source]
  • date -- (Type: date)

SOURCE CODE

[edit | edit source]
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
    ]
]