Re: Postgres and timezones

From: Eelke Klein <eelke(at)bolt(dot)nl>
To: "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Postgres and timezones
Date: 2016-01-20 13:40:22
Message-ID: CALEkvvzTFn6zAcCJ4gVJ8T4UNYqCdD3VACdD0fGjkAM_DcCT-Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2016-01-20 12:10 GMT+01:00 Steve Rogerson <steve(dot)pg(at)yewtc(dot)demon(dot)co(dot)uk>:

> Hi, this is wrong:
>
> # select to_char('2016-01-20 00:00'::timestamp at time zone
> 'Europe/Lisbon',
> 'TZ');
> to_char
> ---------
> GMT
> (1 row)
>
>
> It should be WET, "Western European Time". Is there something I'm doing
> wrong?
>
>
Actually your input is now interpretted as being timezone Europe/Lisbon but
to_char still converts it to a string for the timezone that is currently
set on your connection. When I do (my connection is set to
Europe/Amsterdam)

select to_char('2016-01-20 00:00'::timestamp at time zone 'Europe/Lisbon',
'HH:MI TZ');

I get 01:00 CET because it has converted it from Europe/Lisbon to CET.

You can adjust the timezone which is used for display by to_char with

set timezone='Europe/Lisbon';

Regards,
Eelke

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sachin Srivastava 2016-01-20 14:32:40 Re: Syntax error for Function
Previous Message Pavel Stehule 2016-01-20 13:27:27 Re: Postgres and timezones