REBOL Programming/parse-header-date

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

USAGE:[edit]

PARSE-HEADER-DATE data 

DESCRIPTION:[edit]

(undocumented)


PARSE-HEADER-DATE is a function value.

ARGUMENTS:[edit]

  • data -- (Type: string none)

SOURCE CODE[edit]

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
]