[racket] srfi/19 UTC time

From: John Clements (clements at brinckerhoff.org)
Date: Wed May 22 00:17:50 EDT 2013

On May 21, 2013, at 8:51 PM, Lewis wrote:

> When I use string->date in srfi/19, it defaults to my local time zone.
> I see from the documentation that one can use "~z" to denote the "time
> zone in RFC-822 style". A quick google of RFC-822 suggests "UT" is the
> correct abbreviation for UTC.
> 
> However
> 
> Welcome to Racket v5.3.4.
>> (require srfi/19)
>> (string->date "22/05/13/UT" "~d/~m/~y/~z")
> string->date: TIME-ERROR type bad-date-format-string: "~d/~m/~y/~z"
>  context...:
>   /usr/lib/racket/collects/srfi/19/time.rkt:1532:0: tm:string->date
>   /usr/lib/racket/collects/srfi/19/time.rkt:1569:0: string->date
>   /usr/lib/racket/collects/racket/private/misc.rkt:87:7
> 
> So in short: how - given the day, month and year - can I construct a
> date object that's in UTC?

How important is it to you to use srfi/19?

The program below produces the date that you're looking for, if I understand correctly:


#lang racket

(require racket/date)

(seconds->date (find-seconds 0 0 0 22 05 2013 #f))




Posted on the users mailing list.