Re: time interval format srting

Поиск
Список
Период
Сортировка
От Sam Mason
Тема Re: time interval format srting
Дата
Msg-id 20081104180942.GQ2459@frubble.xen.chris-lamb.co.uk
обсуждение исходный текст
Ответ на time interval format srting  (Joao Ferreira gmail <joao.miguel.c.ferreira@gmail.com>)
Ответы Re: time interval format srting  (Andreas Kretschmer <akretschmer@spamfence.net>)
Список pgsql-general
On Tue, Nov 04, 2008 at 05:06:37PM +0000, Joao Ferreira gmail wrote:
> 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)
>
> any ideas ?
>
> I've been using to_char and to_timestamp to format dates/timestamps...
> but this is diferent... I want to format time intervals, durations..

How about doing:

  SELECT justify_interval(90061 * '1 second'::INTERVAL);

The reason PG makes it a bit difficult is because of things like
daylight savings means that a day can be longer, or shorter, than 24
hours.


  Sam

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

Предыдущее
От: "Francisco Figueiredo Jr."
Дата:
Сообщение: Re: postgresql and Mac OS X
Следующее
От: "A. Kretschmer"
Дата:
Сообщение: Re: time interval format srting