On Mon, Jun 10, 2002 at 03:43:34PM +0200, Karel Zak wrote:
> On Mon, Jun 10, 2002 at 04:26:47PM +0200, Hannu Krosing wr ote:
> > 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 defined
>  as number in range 1..12.

And 'DD' is defined as in range 1..31...
What if I try to select '100 days'?

fduch=> SELECT to_char('100days'::interval, 'YYYY-MM-DD HH24:MI:SS');
       to_char
---------------------
 0000-00-10 00:00:00

Even more:
DDD is day of year, but

fduch=> SELECT to_char('100days'::interval, 'YYYY-MM-DDD HH24:MI:SS');
       to_char
----------------------
 0000-00-069 00:00:00

However, this works fine:
fduch=> SELECT extract(DAY from '100days'::interval);
 date_part
-----------
       100
        
fduch=> SELECT version();
                               version
---------------------------------------------------------------------
 PostgreSQL 7.2.1 on i386-portbld-freebsd4.6, compiled by GCC 2.95.3


I think, interval is too different from timestamp,
and to_char(interval) needs another format syntax and logics...

-- 
Fduch M. Pravking

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly

Reply via email to