Time Data Types and Procedures (original) (raw)

SRFI 19: Time Data Types and Procedures🔗ℹ

Original specification: SRFI 19

The date structure produced by this SRFI library is identical to the one provided by racket/base in most cases (see date).

For backwards compatibility, when an invalid date field value is provided to the SRFI constructor, the constructor will produce alax date structure. A lax date structure is notcompatible with functions from racket/base orracket/date. SRFI functions such asstring->date may return a lax date structure depending on the format string. The predicate lax-date? recognizes lax dat structures.

As an extension, Racket’s implementation of string->datesupports ~? as a conversion specifier: it parses one- and two-digit years like ~yand three- and four-digit years like ~Y.

Examples:

> (string->date "4-1-99" "~d-~m-~?")
(date* 0 0 0 4 1 1999 1 3 #f -18000 0 "")
> (string->date "4-1-1999" "~d-~m-~?")
(date* 0 0 0 4 1 1999 1 3 #f -18000 0 "")

Returns #t if v is a lax date structure. Otherwise, returns #f.

Examples: