Rebol Programming/parse-header-date

From Wikibooks, open books for an open world
Jump to navigation Jump to search

USAGE:[edit | edit source]

PARSE-HEADER-DATE data 

DESCRIPTION:[edit | edit source]

(undocumented)


PARSE-HEADER-DATE is a function value.

ARGUMENTS:[edit | edit source]

  • data -- (Type: string none)

SOURCE CODE[edit | edit source]

parse-header-date: func [
    data [string! none!] /local despace here date count
][
    if none? data [return none] 
    count: 0 
    despace: [to " " here: (
            change here "/" 
            either count = 3 [if #"-" <> second here [insert next here #"+"]] 
            [count: count + 1]
        ) despace | none] 
    parse/all data [opt [thru "," thru " "] date: despace] 
    if error? data: try [to-date date] [data: now] 
    data
]