Re: rounding timestamps

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: rounding timestamps
Дата
Msg-id 20031124032741.GA15475@dcc.uchile.cl
обсуждение исходный текст
Ответ на rounding timestamps  ("Claudio Lapidus" <clapidus@hotmail.com>)
Список 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"

В списке pgsql-general по дате отправления:

Предыдущее
От: "Claudio Lapidus"
Дата:
Сообщение: rounding timestamps
Следующее
От: Joe Conway
Дата:
Сообщение: Re: rounding timestamps