On Mon, Jun 10, 2002 at 04:26:47PM +0200, Hannu Krosing wrote:
> > to_char() convert interval to 'tm' and make output like this struct,
>
> My point is that to_char-ing intervals by converting them to dates is
> non-intuitive.
>
> It is really confusing to say that an interval of 5 months = "May"
> and 15months == "1 March" ;(
>
> > I don't know what other is possible do with it.
>
> perhaps show them with the precision specified and keep data for bigger
> units in biggest specified unit.
>
> to_char('2years 1min 4sec'::interval, 'MM SS'); ==> '24mon 64sec'
> to_char('2years 1min 4sec'::interval, 'MM MI SS'); ==> '24mon 1min 4sec'
>
Hmmm, but it's really out of to_char(). For example 'MM' is definedas number in range 1..12.The to_char() convert
date/timedata to string and not to better formatted interval. The right name for your request is to_interval(). TODO?
Karel
-- Karel Zak <zakkr@zf.jcu.cz>http://home.zf.jcu.cz/~zakkr/C, PostgreSQL, PHP, WWW, http://docs.linux.cz,
http://mape.jcu.cz