Re: Problem with showing time diff?

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: Problem with showing time diff?
Дата
Msg-id 20041113051120.GA24912@winnie.fuhr.org
обсуждение исходный текст
Ответ на Problem with showing time diff?  (Bjørn T Johansen <btj@havleik.no>)
Список pgsql-general
On Thu, Nov 11, 2004 at 11:55:33AM +0100, Bj�rn T Johansen wrote:
>
> select to_char((Log_Fortrykk.SistePlate::time -
> OrdreNew.SistePlate::time)::interval,'HH24:MI') as diff from Log_Fortrykk
>
> I need the output to be HH:MM, e.g. 00:09... But my prb is when this diff
> is less than 0, it shows as 00:-9 and not -00:09

The documentation deprecates to_char(interval, text) and the Release
Notes for 8.0 say that 8.1 will remove it.

You might be able to use substring():

SELECT substring('-00:09:10'::interval from '(.*):[0-9][0-9]$');
 substring
-----------
 -00:09


--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

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

Предыдущее
От: "Marc G. Fournier"
Дата:
Сообщение: Re: Postresql RFD version 2.0 Help Wanted.
Следующее
От: Jan Wieck
Дата:
Сообщение: Re: I spoke with Marc from the postgresql mailing list.