dbTalk Databases Forums  

Re: Problem with showing time diff?

comp.databases.postgresql.general comp.databases.postgresql.general


Discuss Re: Problem with showing time diff? in the comp.databases.postgresql.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Michael Fuhr
 
Posts: n/a

Default Re: Problem with showing time diff? - 11-12-2004 , 11:11 PM






On Thu, Nov 11, 2004 at 11:55:33AM +0100, Bjørn T Johansen wrote:
Quote:
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/

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.