Re: Converting seconds past midnight to a time

Поиск
Список
Период
Сортировка
От Michael Glaesemann
Тема Re: Converting seconds past midnight to a time
Дата
Msg-id 91469550-69FF-48DF-8A9C-0C3012A10371@myrealbox.com
обсуждение исходный текст
Ответ на Converting seconds past midnight to a time  ("Karl O. Pinc" <kop@meme.com>)
Ответы Re: Converting seconds past midnight to a time
Список pgsql-general
On Dec 18, 2005, at 13:25 , Karl O. Pinc wrote:

> What is the best way to convert an integer number of
> seconds past midnight into a time?

Try your_date::timestamptz + your_seconds * interval '1 sec', e.g.,

test=# select current_date::timestamptz, current_date::timestamptz +
1000 * interval '1 sec';
       timestamptz       |        ?column?
------------------------+------------------------
2005-12-18 00:00:00+09 | 2005-12-18 00:16:40+09
(1 row)

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

Why should the int necessarily represent seconds and not some other
amount of time? It's just a unit-less value.

Michael Glaesemann
grzm myrealbox com




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

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