Re: Converting seconds past midnight to a time

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Converting seconds past midnight to a time
Дата
Msg-id 13109.1134879985@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Converting seconds past midnight to a time  ("Karl O. Pinc" <kop@meme.com>)
Список pgsql-general
"Karl O. Pinc" <kop@meme.com> writes:
> What is the best way to convert an integer number of
> seconds past midnight into a time?

Intermediate 'interval' value seems to work:

regression=# select (99.44 * '1 second'::interval)::time;
    time
-------------
 00:01:39.44
(1 row)

> On a related note is there some reason why
> interval + int
> does not result in the interval plus int number
> of seconds?

Again, multiplying the number by '1 sec'::interval would get you there.

            regards, tom lane

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

Предыдущее
От: Michael Glaesemann
Дата:
Сообщение: Re: Converting seconds past midnight to a time
Следующее
От: "Karl O. Pinc"
Дата:
Сообщение: Re: Converting seconds past midnight to a time