SRFI 19: Time Data Types and Procedures
(require srfi/19) | package: srfi-lite-lib |
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 a lax date structure. A lax date structure is not compatible with functions from racket/base or racket/date. SRFI functions such as string->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->date supports ~? as a conversion specifier: it parses one- and two-digit years like ~y and three- and four-digit years like ~Y.
> (string->date "4-1-99" "~d-~m-~?") (date* 0 0 0 4 1 1999 1 3 #f -25200 0 "")
> (string->date "4-1-1999" "~d-~m-~?") (date* 0 0 0 4 1 1999 1 3 #f -25200 0 "")