Re: Getting the name of the timezone, adjusted for daylight saving

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mark Morgan Lloyd <markMLl(dot)pgsql-general(at)telemetry(dot)co(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Getting the name of the timezone, adjusted for daylight saving
Date: 2011-01-26 15:20:49
Message-ID: 15419.1296055249@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Mark Morgan Lloyd <markMLl(dot)pgsql-general(at)telemetry(dot)co(dot)uk> writes:
> 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)

You haven't said exactly what you were hoping to accomplish, but I
suspect the point here is to format a time according to some other zone
than the prevailing TimeZone setting. You basically can't do that, at
least not with to_char and the timestamptz data type --- the information
just isn't there. Consider creating a little plpgsql function that
temporarily changes the timezone setting and then calls to_char.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mark Morgan Lloyd 2011-01-26 17:00:21 Re: Getting the name of the timezone, adjusted for daylight saving
Previous Message Bruce Momjian 2011-01-26 15:04:46 Re: Understanding PG9.0 streaming replication feature