From: | Fduch the Pravking <fduch(at)antar(dot)bryansk(dot)ru> |
---|---|
To: | Karel Zak <zakkr(at)zf(dot)jcu(dot)cz> |
Cc: | Hannu Krosing <hannu(at)tm(dot)ee>, Thomas Lockhart <lockhart(at)fourpalms(dot)org>, josh(at)agliodbs(dot)com, hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Timestamp/Interval proposals: Part 2 |
Date: | 2002-06-11 08:37:09 |
Message-ID: | 20020611123709.E445@zombie.antar.bryansk.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Hannu Krosing | 2002-06-11 09:16:13 | Re: Timestamp/Interval proposals: Part 2 |
Previous Message | Marek Mosiewicz | 2002-06-11 08:01:56 | PostgreSQL OLE DB Provider |