BUG #1058: unexpected output when using timezone() and to_char()

Started by PostgreSQL Bugs Listabout 22 years ago2 messagesbugs
Jump to latest
#1PostgreSQL Bugs List
pgsql-bugs@postgresql.org

The following bug has been logged online:

Bug reference: 1058
Logged by: Blake Crosby

Email address: bcrosby@nm.cbc.ca

PostgreSQL version: 7.3.2

Operating system: FreeBSD 5.1-RELEASE-p11

Description: unexpected output when using timezone() and to_char()

Details:

select to_char(CURRENT_TIMESTAMP,'Day Mon DD YYYY HH24:MI:SS TZ');

returns:

to_char
------------------------------------
Wednesday Jan 21 2004 10:02:11 EST

however,

select to_char(timezone('PST',CURRENT_TIMESTAMP),' Day Mon DD YYYY
HH24:MI:SS TZ');

returns:

to_char
----------------------------------
Wednesday Jan 21 2004 07:07:44

Notice the Time zone field (specified by 'TZ' in the to_char) is missing
from the output.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: PostgreSQL Bugs List (#1)
Re: BUG #1058: unexpected output when using timezone() and to_char()

"PostgreSQL Bugs List" <pgsql-bugs@postgresql.org> writes:

however,
select to_char(timezone('PST',CURRENT_TIMESTAMP),' Day Mon DD YYYY
HH24:MI:SS TZ');
returns:

Wednesday Jan 21 2004 07:07:44

Notice the Time zone field (specified by 'TZ' in the to_char) is missing
from the output.

This isn't a bug. The timezone() function returns datatype timestamp
without time zone, so there is nothing that to_char could usefully
print.

regards, tom lane