From: Mario Splivalo <mario.splivalo@megafon.hr>
To: pgsql <pgsql-sql@postgresql.org>
Subject: date_trunc should be called date_round?
Date: Mon, 29 Jun 2009 10:47:16 +0200
Message-ID: <4A487F94.3070303@megafon.hr> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: mario.splivalo@megafon.hr
Subject: Re: date_trunc should be called date_round?
In-Reply-To: <4A487F94.3070303@megafon.hr>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox