| From: | Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl> |
|---|---|
| To: | Claudio Lapidus <clapidus(at)hotmail(dot)com> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: rounding timestamps |
| Date: | 2003-11-24 03:27:41 |
| Message-ID: | 20031124032741.GA15475@dcc.uchile.cl |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Mon, Nov 24, 2003 at 12:15:54AM -0300, Claudio Lapidus wrote:
> But my problem is that to_char truncates the fractional seconds, and I need
> to round the value to the nearest integer second. In the above, I would need
> the output rounded to 15:31:00, which is just a millisecond away, for
> example. But I couldn't find a function to round a timestamp. Are there any
> workaround?
Maybe you can try with EXTRACT(epoch FROM timestamp), rounding that, and
then converting back to a timestamp through abstime. Ugly though ...
--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Hoy es el primer día del resto de mi vida"
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Joe Conway | 2003-11-24 03:31:26 | Re: rounding timestamps |
| Previous Message | Claudio Lapidus | 2003-11-24 03:15:54 | rounding timestamps |