datetime function

Started by Chris Bowlbyover 23 years ago2 messagesgeneral
Jump to latest
#1Chris Bowlby
excalibur@hub.org

Hi Guy's,

Noticing an issue with the datetime funciton when being used with
'epoch', it is giving different results then before..

select version();
version
---------------------------------------------------------------------
PostgreSQL 7.1.2 on i386-unknown-freebsd4.3, compiled by GCC 2.95.3
(1 row)

set time zone 'GMT';
SET VARIABLE
select datetime('epoch') + "interval"('0 seconds');
?column?
------------------------
1970-01-01 00:00:00+00
(1 row)

set time zone 'PST8PDT';
SET VARIABLE
select datetime('epoch') + "interval"('0 seconds');
?column?
------------------------
1969-12-31 16:00:00-08
(1 row)

==========================================================================
select version();
version
---------------------------------------------------------------------
PostgreSQL 7.2.1 on i386-unknown-freebsd4.3, compiled by GCC 2.95.3
(1 row)

set time zone 'GMT';
SET VARIABLE
select datetime('epoch') + "interval"('0 seconds');
?column?
---------------------
1970-01-01 00:00:00 <== what's happened to the offset , i.e. "+00" ?
(1 row)

set time zone 'PST8PDT';
SET VARIABLE
select datetime('epoch') + "interval"('0 seconds');
?column?
---------------------
1970-01-01 00:00:00 <== why is this not "1969-12-31 16:00:00-08" ?

(1 row)

Chris Bowlby,
-----------------------------------------------------
Manager of Information and Technology.
excalibur@hub.org
www.hub.org
1-902-542-3657
-----------------------------------------------------

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Chris Bowlby (#1)
Re: datetime function

Chris Bowlby <excalibur@hub.org> writes:

Noticing an issue with the datetime funciton when being used with
'epoch', it is giving different results then before..

There is no "datetime function". What you have there is a
soon-to-be-obsolete alias for the timestamp datatype. What you
probably actually want is timestamptz (timestamp with timezone)
which is the current equivalent to the old datetime datatype...

regards, tom lane