Il 17/02/2010 17.25, Mladen Gogala ha scritto:
Quote:
On Wed, 17 Feb 2010 13:55:46 +0100, news wrote:
Hi, does date_trunc return values related to current timezone?
No. It only truncates the given timestamp value to the requested
precision: http://tinyurl.com/yju3snt |
You right, the source of my problems it is extract:
db_atm=# select 'epoch'::timestamp + '1234567890 seconds'::interval;
?column?
---------------------
2009-02-13 23:31:30
(1 row)
db_atm=# select extract('epoch' from 'epoch'::timestamp + '1234567890
seconds'::interval);
date_part
------------
1234564290
(1 row)
db_atm=# select extract('epoch' from ('epoch'::timestamp + '1234567890
seconds'::interval) at time zone 'UTC');
date_part
------------
1234567890
(1 row)
db_atm=# select date_trunc('minute', 'epoch'::timestamp + '1234567890
seconds'::interval);
date_trunc
---------------------
2009-02-13 23:31:00
(1 row)
db_atm=# select date_trunc('minute', ('epoch'::timestamp + '1234567890
seconds'::interval) at time zone 'UTC');
date_trunc
------------------------
2009-02-14 00:31:00+01
(1 row)