Re: Strategies for converting UTC data to local windows for arbitrary resolutions and timezones

From: Lincoln Swaine-Moore <lswainemoore(at)gmail(dot)com>
To: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Strategies for converting UTC data to local windows for arbitrary resolutions and timezones
Date: 2023-10-04 19:16:05
Message-ID: CABcidkLUzPf2npEH3P+OMYA53o4=xOAMrn_LZzu8nSgdnmRJHQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Really UTC (not that it matters for calculation purposes)

Sorry, yes--I just meant that literally when I run `show timezone` on the
server in question, I get `GMT`.

> As to "other places" in your (or others) code, provided that you are
storing and manipulating your data as timestamp WITH time zone (point in
time)

Unfortunately this is not the case for my codebase/schema. The data is
stored WITHOUT. I glossed over this fact in my post, because they are in
fact UTC times that have had their (0) offset truncated, and prior to my
usage of any solution I can use `at time zone 'UTC'` to properly handle
them. But I don't think it's the case that in the application more
generally this is being handled gracefully, and so the behavior that is
currently (correctly) running is being propped up by the database's time
zone setting. In the long term, I think it might be appropriate to create a
new column that is simply `t at time zone 'UTC'`, and use that everywhere,
but that's not feasible for the task I'm handling right now.

Thanks!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Lincoln Swaine-Moore 2023-10-04 19:30:51 Re: Strategies for converting UTC data to local windows for arbitrary resolutions and timezones
Previous Message Alban Hertroys 2023-10-04 19:06:34 Re: Strategies for converting UTC data to local windows for arbitrary resolutions and timezones