From: | "Claudio Lapidus" <clapidus(at)hotmail(dot)com> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | rounding timestamp |
Date: | 2003-11-20 21:12:53 |
Message-ID: | BAY7-DAV45WKEVqr4YF000072f5@hotmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello
I need to output a timestamp attribute formatted to fixed-width, no spaces
nor separators, something like
test=> select to_char(timestamp '2003-10-24 15:30:59.999',
'YYYYMMDDHH24MISS');
to_char
----------------
20031024153059
(1 row)
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?
thanks
cl.
From | Date | Subject | |
---|---|---|---|
Next Message | Mike Mascari | 2003-11-20 21:13:19 | Re: performance problem |
Previous Message | Rick Gigger | 2003-11-20 21:12:32 | Re: performance problem |