"Stefan Waidele jun." wrote:
>At 13:37 18.01.2001 -0500, Tom Lane wrote:
>>"Stefan Waidele jun." <St.Waidele.jun@Krone-Neuenburg.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.Elphick@lfix.co.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