# Date-\>seconds and time-zone-offsets

**URL:** <https://racket.discourse.group/t/date-seconds-and-time-zone-offsets/3923>\
**Category:** Questions & Answers\
**Created:** [August 26, 2025, 11:30am UTC](https://racket.discourse.group/t/date-seconds-and-time-zone-offsets/3923 "2025-08-26T11:30:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![hnmdijkema](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/hnmdijkema/32/2629_2.png) [@hnmdijkema](https://racket.discourse.group/u/hnmdijkema)\
**Post date:** [August 26, 2025, 11:30am UTC](https://racket.discourse.group/t/date-seconds-and-time-zone-offsets/3923/1 "2025-08-26T11:30:37Z")

</div>

I hope someone can clarify this.

I'm experimenting with racket dates and timezone info. I did following:

```scheme
Welcome to DrRacket, version 8.18 [cs].
Language: racket/base [custom].
> (define s (current-seconds))
> (define d1 (seconds->date s))
> (define d-utc (seconds->date s #f))
> d1
(date* 29 22 13 26 8 2025 2 237 #f 7200 0 "West-Europa (zomertijd)")
> d-utc
(date* 29 22 11 26 8 2025 2 237 #f 0 0 "UTC")
> (define s1 (date->seconds d-utc))
> (define s2 (date->seconds d1))
> s1
1756200149
> s2
1756207349
> s
1756207349
> 

```

Now, as one can see, 's' is (current-seconds).

When I convert with seconds-\>date , it looks like the right date\* structs are created.

Now, I convert back from d1 (which is in localtime) and d-utc.

I would expect s1 and s2 to be equal (i.e. (= s1 s2) gives #t). And both would be equal to s.

But this is not the case.

Consulting [https://www.epochconverter.com/](https://www.epochconverter.com/)

Local time (CET) to seconds:

 ![afbeelding](https://global.discourse-cdn.com/free1/uploads/racket/original/2X/2/2509557b0b526b05606f587b1934d6de3ec9f575.png)

GMT time (UTC) to seconds:

 ![afbeelding](https://global.discourse-cdn.com/free1/uploads/racket/original/2X/b/b958fd9483f542e3afff95fe806bc752af91a405.png)

Am I missing something in racket?

---

<div class="post-metadata">

**Author:** ![LiberalArtist](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/liberalartist/32/151_2.png) [@LiberalArtist](https://racket.discourse.group/u/LiberalArtist)\
**Post date:** [August 26, 2025, 12:10pm UTC](https://racket.discourse.group/t/date-seconds-and-time-zone-offsets/3923/2 "2025-08-26T12:10:16Z")

</div>

What you are missing is:

> **[Gregor: Dates and Times](https://docs.racket-lang.org/gregor/index.html)**

The `date` and `date*` structs from the `racket` libraries, which are relics of our Scheme heritage, deal _at best_ with UTC offsets with names, which are a crude approximation of the complex things we call “time zones.” In fairness, I think there probably is some way of getting them to do what you want in your example, but, for any non-trivial use of dates or times in Racket, you are best off leaving them behind and embracing the replacements from Gregor. Even the [documentation for `racket/date`](https://docs.racket-lang.org/reference/time.html#(part._date-string)) recommends Gregor!

---

<div class="post-metadata">

**Author:** ![hnmdijkema](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/hnmdijkema/32/2629_2.png) [@hnmdijkema](https://racket.discourse.group/u/hnmdijkema)\
**Post date:** [August 26, 2025, 1:02pm UTC](https://racket.discourse.group/t/date-seconds-and-time-zone-offsets/3923/3 "2025-08-26T13:02:48Z")

</div>

Ah, oké! Thanks you, I’ll use gregor dates. Does this also do conversions from seconds/strings to dates/times + timezone conversions?

---

<div class="post-metadata">

**Author:** ![hnmdijkema](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/hnmdijkema/32/2629_2.png) [@hnmdijkema](https://racket.discourse.group/u/hnmdijkema)\
**Post date:** [August 26, 2025, 3:26pm UTC](https://racket.discourse.group/t/date-seconds-and-time-zone-offsets/3923/4 "2025-08-26T15:26:21Z")

</div>

Just 1 other question about this. Are there conversions functions from racket dates to gregor dates/datetimes/moments and vise versa?

Maybe it is of no concern…

Why is the gregor module not part of the racket standard set btw?

---

<div class="post-metadata">

**Author:** ![jbclements](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/jbclements/32/11_2.png) [@jbclements](https://racket.discourse.group/u/jbclements)\
**Post date:** [August 26, 2025, 4:50pm UTC](https://racket.discourse.group/t/date-seconds-and-time-zone-offsets/3923/5 "2025-08-26T16:50:39Z")

</div>

Potentially stepping on mines here, but... I think that gregor offers an entirely parallel time library; I believe there are no conversion functions because if you're going to use Gregor, you're probably "all in," and you would likely never touch racket dates at all. In fact, my recollection is that there are name collisions, so it's at least mildly difficult to use both of them.

I like gregor, and I tend to use it. With that said, I usually spend more time than I would like searching for a particular conversion function. I would say that Gregor suffers from three problems, and none is a deal-killer. First, it uses a naming convention that is somewhat idiosyncratic. Second, it could use some "streamlining", the kind of thing that happens when a library (both documentation and functionality) adapts to widespread usage. Third, time itself is kind of a nightmare (a "time" is different from a "date", there are multiple distinct ideas and english terms are often used in different ways), and Gregor is both confident and firm in its distinctions.

These are all just my opinions.

---

<div class="post-metadata">

**Author:** ![JustinZed](https://avatars.discourse-cdn.com/v4/letter/j/8e7dd6/32.png) [@JustinZed](https://racket.discourse.group/u/JustinZed)\
**Post date:** [August 26, 2025, 5:42pm UTC](https://racket.discourse.group/t/date-seconds-and-time-zone-offsets/3923/6 "2025-08-26T17:42:48Z")

</div>

> Third, time itself is kind of a nightmare

Indeed. Reading this article and its follow-up was enlightening: [Falsehoods programmers believe about time: @noahsussman: Infinite Undo](https://infiniteundo.com/post/25326999628/falsehoods-programmers-believe-about-time)
