Re: How to get timezone offset in timestamp with time zone AT TIME ZONE output.

2019-09-24 Thread Andrew Gierth
> "rob" == rob stone writes: rob> You can EXTRACT timezone, timezone_hour and timezone_minute from a rob> timestamp. Using 'timezone' returns a value representing seconds rob> from UTC. Yes, but this always outputs a value representing the server timezone; there's no way (other than the s

Re: How to get timezone offset in timestamp with time zone AT TIME ZONE output.

2019-09-24 Thread rob stone
On Wed, 2019-09-25 at 10:12 +1000, Paul McGarry wrote: > > On Wed, Sep 25, 2019 at 5:44 AM Adrian Klaver < > adrian.kla...@aklaver.com> wrote: > > > Andrew's function seems plausible and I need to find some time to > test it, but I am slightly surprised there isn't a native way to get > the o

Re: How to get timezone offset in timestamp with time zone AT TIME ZONE output.

2019-09-24 Thread Andrew Gierth
> "Paul" == Paul McGarry writes: > On Wed, Sep 25, 2019 at 5:44 AM Adrian Klaver > wrote: >> >> "Therefore whatever renders the offset needs to be capable of doing >> it per row, independently of the server/session time zone." The key point here is that storing the timestamp as WITHOUT

Re: How to get timezone offset in timestamp with time zone AT TIME ZONE output.

2019-09-24 Thread Paul McGarry
On Wed, Sep 25, 2019 at 5:44 AM Adrian Klaver wrote: > > The issue is unclear so I am not sure you can discount this as a > solution. The OP had: > > CREATE TABLE users ( > user_id biginit, > user_timezone text, -- Eg 'Australia/Sydney','Asia/Hong_Kong' > ); > CREATE TABLE data ( > id bigint, > u

Re: How to get timezone offset in timestamp with time zone AT TIME ZONE output.

2019-09-24 Thread Adrian Klaver
On 9/23/19 7:40 PM, Andrew Gierth wrote: "Adrian" == Adrian Klaver writes: Adrian> This has come up before and the general suggestion has been to Adrian> have a column for a naive(timestamp w/o tz) timestamp and a Adrian> column for the timezone. No, that's usually (not always) backward

Re: How to get timezone offset in timestamp with time zone AT TIME ZONE output.

2019-09-23 Thread Andrew Gierth
> "Adrian" == Adrian Klaver writes: Adrian> This has come up before and the general suggestion has been to Adrian> have a column for a naive(timestamp w/o tz) timestamp and a Adrian> column for the timezone. No, that's usually (not always) backwards, and in any event wouldn't solve this p

Re: How to get timezone offset in timestamp with time zone AT TIME ZONE output.

2019-09-23 Thread Adrian Klaver
On 9/23/19 1:32 AM, Paul McGarry wrote: Hi there, Does anyone have a good way of doing: = select '2020-04-04 15:00:00+00'::timestamp with time zone AT TIME ZONE 'Australia/Sydney';       timezone -  2020-04-05 02:00:00 select '2020-04-04 16:00:00+00'::timestamp with

Re: How to get timezone offset in timestamp with time zone AT TIME ZONE output.

2019-09-23 Thread Andrew Gierth
> "Paul" == Paul McGarry writes: Paul> Hi there, Paul> Does anyone have a good way of doing: Paul> = Paul> select '2020-04-04 15:00:00+00'::timestamp with time zone AT TIME ZONE Paul> 'Australia/Sydney'; Paul> timezone Paul> - Paul> 2020-04-05 02:00:00

How to get timezone offset in timestamp with time zone AT TIME ZONE output.

2019-09-23 Thread Paul McGarry
Hi there, Does anyone have a good way of doing: = select '2020-04-04 15:00:00+00'::timestamp with time zone AT TIME ZONE 'Australia/Sydney'; timezone - 2020-04-05 02:00:00 select '2020-04-04 16:00:00+00'::timestamp with time zone AT TIME ZONE 'Australia/Sydney';