From: | Tomasz Myrta <jasiek(at)klaster(dot)net> |
---|---|
To: | Bruno Wolff III <bruno(at)wolff(dot)to> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Does anyone use TO_CHAR(INTERVAL)? |
Date: | 2003-03-26 08:17:18 |
Message-ID: | 3E81620E.20604@klaster.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Uz.ytkownik Bruno Wolff III napisa?:
> On Tue, Mar 25, 2003 at 20:24:55 +0100,
> Tomasz Myrta <jasiek(at)klaster(dot)net> wrote:
>
>>Uz.ytkownik Josh Berkus napisa?:
>>
>>It looks it could be useful to display how much time is left for
>>scheduling cases, but as I wrote few threads ago - displaying intervals
>>longer than one month is useless without specific date.
>
>
> That isn't true. Intervals have two parts. One is time difference in
> fixed time and the other is a difference in months. You could display
> both parts when they are both nonzero.
>
> I haven't found the documenation too specific on which part gets added
> first (and this does make a difference in some cases).
It looks like you are right:
SELECT cast('300 days' as interval)+cast('1 month' as interval);;
?column?
----------------
1 mon 300 days
SELECT to_char(cast('300 days' as interval)+cast('1 month' as
interval),'DDD');;
to_char
---------
300
(1 row)
SELECT to_char('2002-12-31'::timestamp
-'2002-01-01'::timestamp,'YYYY-MM-DD');;
to_char
-------------
0000-00-36
(1 row)
Thanks for noticing this, these results are really strange for me.
I should remember NOT to use months when working with intervals. It
looks like intervals contain 2 totally independent values inside.
I have one more question to this thread - Does anyone use intervals
month value?
Tomasz
From | Date | Subject | |
---|---|---|---|
Next Message | Christoph Haller | 2003-03-26 09:16:32 | Re: How to show timestamp with milliseconds(3 digits) in Select |
Previous Message | Christoph Haller | 2003-03-26 08:08:34 | Re: How to increase Column width of table |