Where exactly do you see sql-timestamp->srfi-date failing? In your
examples, what I'm seeing is incorrect translation from UTC to UTC-4,
but I don't see where the translation from sql-timestamp to date* is
going wrong. Could you point to exactly where you see the problem?

As far as offsetting time zones properly, Racket's built-in libraries
will not help you there. You might want to check out my library,
gregor: http://pkg-build.racket-lang.org/doc/gregor/index.html. You'd
still need to write your own sql-datetime->moment function, but that's
not difficult. In fact:

(require gregor)
(require racket/match)

(define (sql-timestamp->moment t)
  (match-define (sql-timestamp y mo d h mi s n tz) t)

  (moment y mo d h mi s n #:tz (or tz 0)))

Unfortunately, since sql-timestamp only represents time zones as
offsets from UTC, you're a bit limited from the start. Gregor
certainly can use UTC offsets as TZs but prefers to use IANA names
(e.g., "America/New_York").

-Jon


On Sat, Aug 22, 2015 at 3:45 PM, George Neuner <gneun...@comcast.net> wrote:
>
> Ok, reading the docs more carefully, I realized that  seconds->date  takes a
> boolean and not a time zone offset, but that doesn't explain why
> sql-timestamp->srfi-date is not working properly.
>
> I'm now offsetting the time with
>
> (seconds->date
>     (+ (date*->seconds ts  #f) (* timezone 60 60))
>      #f))
>
> which gives me the right time, but in the wrong time zone.
>
> Just how do I offset time zones properly?   Do I need to construct the date*
> piecemeal?
>
> Thanks,
> George
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to