From: | Michael Fuhr <mike(at)fuhr(dot)org> |
---|---|
To: | =?ISO-8859-1?Q?Bj=F8rn_T_Johansen?= <btj(at)havleik(dot)no> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Problem with showing time diff? |
Date: | 2004-11-13 05:11:20 |
Message-ID: | 20041113051120.GA24912@winnie.fuhr.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, Nov 11, 2004 at 11:55:33AM +0100, Bjrn 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/
From | Date | Subject | |
---|---|---|---|
Next Message | Jan Wieck | 2004-11-13 05:29:05 | Re: I spoke with Marc from the postgresql mailing list. |
Previous Message | Marc G. Fournier | 2004-11-13 02:36:06 | Re: Postresql RFD version 2.0 Help Wanted. |