pgjdbc/pgjdbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feedFrom: davecramer (@davecramer) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: Re: [pgjdbc/pgjdbc] issue #3692: Wrong time formatting ResultSet.getTime(); for Europe/Belgrade and "Europe/Prague"
Date: Thu, 21 Aug 2025 23:55:52 +0000
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
So this is an artifact of how timestamptz is handled by postgres
```
set timezone to "America/Los_Angeles";
INSERT INTO t VALUES
('2023-11-10 09:00:00', '2023-11-10 09:00:00-08'), -- PST (UTC-8)
('2023-03-13 09:00:00', '2023-03-13 09:00:00-07'); -- PDT (UTC-7);
INSERT 0 2
postgres=# table t;
ts | tz
---------------------+------------------------
2023-11-10 09:00:00 | 2023-11-10 09:00:00-08
2023-03-13 09:00:00 | 2023-03-13 09:00:00-07
(2 rows)
postgres=# set timezone to gmt;
SET
postgres=# table t;
ts | tz
---------------------+------------------------
2023-11-10 09:00:00 | 2023-11-10 17:00:00+00
2023-03-13 09:00:00 | 2023-03-13 16:00:00+00
```
Note the time that is stored in the second row is actually 1 hour earlier as. you had asked. It does not honour your UTC-7 as being the timezone for that insert it calculates the time `2023-03-13 09:00:00-07` and stores it in `America/Los_Angeles` timezone (well not really, it actually stores it in GMT)
See what the time was when I set the session timezone to GMT!
Postgres does not actually store a timezone with the timestamptz. it just takes whatever is in the column and displays it correctly for the current timezone.
view thread (8+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: github://pgjdbc/pgjdbc
Cc: [email protected], [email protected]
Subject: Re: [pgjdbc/pgjdbc] issue #3692: Wrong time formatting ResultSet.getTime(); for Europe/Belgrade and "Europe/Prague"
In-Reply-To: <<[email protected]>>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox