Re: time interval format srting

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: time interval format srting
Date: 2008-11-04 18:12:37
Message-ID: 20081104181237.GA20425@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

am Tue, dem 04.11.2008, um 17:06:37 +0000 mailte Joao Ferreira gmail folgendes:
> Hello,
>
> 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 ?

Something like this?

test=*# select (90061 / (24*3600))::text || ' days ' ||
to_char('3661'::interval, 'hh h mi m ss s')::text;
?column?
-----------------------
1 days 01 h 01 m 01 s
(1 Zeile)

Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jonathan Guthrie 2008-11-04 18:18:01 Re: I'm puzzled by a foreign key constraint problem
Previous Message Sam Mason 2008-11-04 18:09:42 Re: time interval format srting