Re: [NOVICE] Re: Interval output format

From: "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk>
To: pgsql-novice(at)postgresql(dot)org
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [NOVICE] Re: Interval output format
Date: 2001-01-19 00:02:41
Message-ID: 200101190002.f0J02kq01968@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-novice

"Stefan Waidele jun." wrote:
>At 13:37 18.01.2001 -0500, Tom Lane wrote:
>>"Stefan Waidele jun." <St(dot)Waidele(dot)jun(at)Krone-Neuenburg(dot)de> writes:
>> > How can I tell Postgres to return an interval value in an format like
>> hhh:mm?
>>
>>See to_char(),
>>http://www.postgresql.org/devel-corner/docs/postgres/functions-formatting.h
>tm

to_char() can't take an interval, even in 7.1:

bray=# select proname,pronargs,proargtypes from pg_proc where proname = 'to_char';
proname | pronargs | proargtypes
---------+----------+-------------
to_char | 2 | 20 25
to_char | 2 | 23 25
to_char | 2 | 700 25
to_char | 2 | 701 25
to_char | 2 | 1184 25
to_char | 2 | 1700 25
(6 rows)

and date_part() merely extracts the requested part, thus losing data:

bray=# select date_part('hour','3 days 10:23'::INTERVAL);
date_part
-----------
10
(1 row)

Can to_char be extended?
--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"For the eyes of the LORD run to and fro throughout the
whole earth, to show himself strong in the behalf of
them whose heart is perfect toward him..."
II Chronicles 16:9

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Lockhart 2001-01-19 00:53:52 Re: converting from text -> inet ... possible?
Previous Message Peter Eisentraut 2001-01-18 23:48:06 Re: AW: AW: AW: AW: AW: Re: tinterval - operator problems o n AI X

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Case 2001-01-19 00:14:35 on re-starting i lost access to a database
Previous Message Ken Corey 2001-01-18 23:56:47 Re: Yikes! Bitten by line length?