Getting the name of the timezone, adjusted for daylight saving

From: Mark Morgan Lloyd <markMLl(dot)pgsql-general(at)telemetry(dot)co(dot)uk>
To: pgsql-general(at)PostgreSQL(dot)org
Subject: Getting the name of the timezone, adjusted for daylight saving
Date: 2011-01-26 09:52:18
Message-ID: ihoqsj$vsq$1@pye-srv-01.telemetry.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Running 8.4.6 hosted on Linux, if I do this...

SELECT to_char('2011-03-01 12:00' AT TIME ZONE 'GMT0BST', 'HH24:MI TZ');
to_char
---------
12:00
(1 row)

..I don't get a timezone- I can live with that.

If I do this...

SELECT to_char(('2011-03-01 12:00' AT TIME ZONE 'GMT0BST')::TIMESTAMP
WITH TIME ZONE, 'HH24:MI TZ');
to_char
-----------
12:00 GMT
(1 row)

..then I get the GMT time with a timezone 'GMT'- that's what I want.

But if I do this...

SELECT to_char(('2011-04-01 12:00' AT TIME ZONE 'GMT0BST')::TIMESTAMP
WITH TIME ZONE, 'HH24:MI TZ');
to_char
-----------
13:00 GMT
(1 row)

..then I get the time corrected for daylight saving- which is what I
want- but the timezone doesn't indicate that daylight saving has been
applied.

In the general case, how can I get TZ indicating whether daylight saving
is in effect? Alternatively, is there a flag I can retrieve indicating
that a timestamp has been corrected for DST so that I can select an
alternative name for display?

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bill Moran 2011-01-26 14:09:29 Re: Store base64 in database. Use bytea or text?
Previous Message tuanhoanganh 2011-01-26 09:01:45 Re: PostgreSQL 9.0 service error : The service did not respond to the start or control request in a timely fashion.