Re: Problem with showing time diff? - Mailing list pgsql-general

From Michael Fuhr
Subject Re: Problem with showing time diff?
Date
Msg-id 20041113051120.GA24912@winnie.fuhr.org
Whole thread Raw
In response to Problem with showing time diff?  (Bjørn T Johansen <btj@havleik.no>)
List 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 by date:

Previous
From: "Marc G. Fournier"
Date:
Subject: Re: Postresql RFD version 2.0 Help Wanted.
Next
From: Jan Wieck
Date:
Subject: Re: I spoke with Marc from the postgresql mailing list.