It's stated in the docs that date_trunc is "conceptually similar to the
trunc function for numbers.".

So, trunc(1.1) = 1, trunc(1.9) = 1, and so on.

But, date_trunc behaves like round function: round(1.9) = 2.

Example:

idel=# select date_trunc('milliseconds', '2009-01-01
12:15:00.000999+02'::timestamp with time zone);
         date_trunc
----------------------------
 2009-01-01 11:15:00.001+01
(1 row)

fidel=# select version();
                                                 version

----------------------------------------------------------------------------------------------------------
 PostgreSQL 8.3.7 on x86_64-unknown-linux-gnu, compiled by GCC
gcc-4.3.real (Ubuntu 4.3.3-5ubuntu4) 4.3.3
(1 row)


Or am I again completely misreading something?

        Mike

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

Reply via email to