Re: time interval format srting

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: time interval format srting
Дата
Msg-id dcc563d10811041001h481e212dw2ae7ac38bb3f664f@mail.gmail.com
обсуждение исходный текст
Ответ на Re: time interval format srting  ("Scott Marlowe" <scott.marlowe@gmail.com>)
Список pgsql-general
On Tue, Nov 4, 2008 at 10:53 AM, Scott Marlowe <scott.marlowe@gmail.com> wrote:
> On Tue, Nov 4, 2008 at 10:06 AM, Joao Ferreira gmail
> <joao.miguel.c.ferreira@gmail.com> wrote:
>> Hello,
>>
>> I've been searching the docs on a simple way to convert a time
>> _duration_ in seconds to the format dd:hh:mm:ss, but I can't find it.
>>
>> 90061 --> 1d 1h 1m 1s
>>
>> (90061=24*3600+3600+60+1)
>
> select number*interval '1 sec';

OK, that just gives hours:minutes:seconds.  You can add and subtract
the same timestamp to get something like an interval

select ((9084000*interval '1 sec')+timestamp '2008-01-01')-timestamp
'2008-01-01';

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

Предыдущее
От: Steve Atkins
Дата:
Сообщение: Re: Semi-customized queries? Subset of SQL? Accessing the parser? Injection?
Следующее
От: "Francisco Figueiredo Jr."
Дата:
Сообщение: Re: postgresql and Mac OS X