The closest thing I came up with looking at the documentation was
(define (sql-datetime->rfc2822 datetime)
(let ([dt (sql-datetime->srfi-date datetime)])
(date->string dt (date-display-format 'rfc2822))))
But it fails when I pass it a sql-timestamp
> (sql-datetime->rfc2822 st)
. . date->string: contract violation
expected: date?
given: (tm:date 456232000 10 39 18 5 5 2013 0)
in: the 1st argument of
(->* (date?) (any/c) string?)
contract from: <collects>/racket/date.rkt
Prior to Racket version 5.3.4, you need to use the date->string function from the srfi/19 library because the structure types for racket/date and srfi/19 are incompatible (in 5.3.4, which will be released soon, they use the same structure). It should work if you (require srfi/19) and use the API defined there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With