Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-general by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group