0

I have an application generating an expiration timestamp. I had some problems, so I debugged around a bit and it confuses me more and more.

I use this example:

SELECT TIMESTAMP '2013-08-13 00:00:00' AT TIME ZONE 'UTC'

When I run this in Navicat, I get back

timezone
----------------------
2013-08-12 22:00:00+00

When I run this code in DBeaver, I get back

timezone
-------------------
2013-08-13 02:00:00

It is the same DB, the same user, the same schema, the only difference is the client programm from which I call this example. Where does the difference between the results come from?

Mochi
  • 173
  • 1
  • 12
  • A time zone configuration for the current session can be set when connecting to a database. Different Clients connect to the database in different ways. One client may send a time zone configuration for the session, the other one may not (in this case the default server time zone is used). It seems you can see the current time zone configuration with "show timezone;" – JayTheKay Dec 02 '20 at 13:13
  • Yes, that is also what I think. But I do not know where to explicitly tell the program or the connection wihich timezone to use. Or how do I tell that to the pg_connect. – Mochi Dec 02 '20 at 13:20
  • This seems to be an issue of different presentation/formatting in Navicat & DBeaver. I think that explicit formatting, i.e. `select to_char(timestamp '2013-08-13 00:00:00' AT TIME ZONE 'UTC', 'YYYY-MM-DD HH24:MI:SSOF');` will produce consistent results. – Stefanov.sm Dec 02 '20 at 13:36
  • For `DBeaver` you should take a look at Aashutosh Taikar's answer(at bottom) from this SO [question](https://stackoverflow.com/questions/45323552/how-to-change-dbeaver-timezone-how-to-stop-dbeaver-from-converting-date-and-ti/54401047#54401047) – Adrian Klaver Dec 02 '20 at 15:21

0 Answers0