| From: | "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at> |
|---|---|
| To: | pgsql-general(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Timezone handling with timestamp without time zone columns |
| Date: | 2026-02-28 12:00:54 |
| Message-ID: | 7eb7di2cb63iryenre6vc5bzqswpbna5rriazrn4zquppj5zqb@4whytmyvvmet |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On 2026-02-27 16:01:10 +0100, Laurenz Albe wrote:
> The best practice is that you store tmestamps in a consistent fashion:
ACK.
> either
>
> - use "timestamp with time zone", store timestamps with time zone
> and make sure that the parameter "timezone" is set correctly in each
> database session
>
> or
>
> - use "timestamp without time zone" and store only Chicago timestamps
> without a time zone
Be aware though that in timezones with DST there is one hour in autumn
which cannot be properly represented:
hjp=> set timezone = 'Canada/Pacific';
SET
hjp=> select '2025-11-02 08:23Z'::timestamptz::timestamp;
╔═════════════════════╗
║ timestamp ║
╟─────────────────────╢
║ 2025-11-02 01:23:00 ║
╚═════════════════════╝
(1 row)
hjp=> select '2025-11-02 09:23Z'::timestamptz::timestamp;
╔═════════════════════╗
║ timestamp ║
╟─────────────────────╢
║ 2025-11-02 01:23:00 ║
╚═════════════════════╝
(1 row)
(OTOH sometimes you need the local time without any reference to a time
zone or at least without a UTC offset)
hjp
--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp(at)hjp(dot)at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ron Johnson | 2026-02-28 22:39:37 | Re: Can "on delete cascade" dependency be used in pgdump or similar ? |
| Previous Message | Adrian Klaver | 2026-02-27 23:15:45 | Re: Can "on delete cascade" dependency be used in pgdump or similar ? |