Re: qdate bug

Skip to first unread message

Jesse Gumm

Dec 6, 2021, 8:36:06 PM12/6/21
to nitrogenweb
Hi Jean-Yves,

Sorry for the delay here - this was filtered into spam, and just happened on it searching for something else completely unrelated :)

It's hard to troubleshoot here because I'm not sure what date() and time() are returning.  Are they returning the same thing, but qdate is misinterpreting them?

I personally almost always use os:timestamp() instead of date() and time() because I don't trust those functions while os:timestamp() is timezone-neutral (or rather are always UTC)


On Wed, Dec 1, 2021 at 5:26 PM <> wrote:
Hi folks,
qdate has a weird behavior :
under postgresql : SELECT CURRENT_TIMESTAMP(0) :
 2021-12-02 00:20:02+01
with Nitrogen : Function : TS=qdate:to_string("Y-m-d H:i:s O", ?TZ, {date(), time()})
?PRINT(TS). (with ?TZ == "Europe/Paris")
Nitrogen console :
=INFO REPORT==== 2-Dec-2021::00:19:58.308662 ===
index: Reloaded! (Beam changed.)

=INFO REPORT==== 2-Dec-2021::00:20:17.519826 ===
DEBUG: <0.26233.1>
  "2021-12-02 01:20:17 +0100"
Huuu!? One extra hour added to the regular time, why is that??
However, launching an independent Erlang interpreter with "-pa ./lib/qdate/ebin" returns the correct timestamp :
156> qdate:to_string("Y-m-d H:i:sO", "Europe/Paris", {date(), time()}).
"2021-12-02 00:20:50+0100"
Where does this extra hour comes from?

You received this message because you are subscribed to the Google Groups "Nitrogen Project / The Nitrogen Web Framework for Erlang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Jesse Gumm
Owner, Sigma Star Systems
414.940.4866 || || @jessegumm

Dec 7, 2021, 6:24:10 AM12/7/21
to Nitrogen Project / The Nitrogen Web Framework for Erlang
Hi Jesse,

I found a solution, in my function I added a TZ initialization and used another version of the timestamp function:
my_bioutifoul_ts() ->
    , qdate:to_string("Y-m-d H:i:s O", {date(), time()}).

which is working ferpectly :) (may be it was the lack of TZ definition that triggered that, my fault as usual).


Jesse Gumm

Dec 7, 2021, 8:46:46 AM12/7/21
to nitrogenweb

Glad you were able to figure it out!


Reply all
Reply to author
0 new messages