Re: Postgres and timezones - Mailing list pgsql-general

From Eelke Klein
Subject Re: Postgres and timezones
Date
Msg-id CALEkvvzTFn6zAcCJ4gVJ8T4UNYqCdD3VACdD0fGjkAM_DcCT-Q@mail.gmail.com
Whole thread Raw
In response to Postgres and timezones  (Steve Rogerson <steve.pg@yewtc.demon.co.uk>)
List pgsql-general


2016-01-20 12:10 GMT+01:00 Steve Rogerson <steve.pg@yewtc.demon.co.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

pgsql-general by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Postgres and timezones
Next
From: Sachin Srivastava
Date:
Subject: Re: Syntax error for Function