From: Tomasz Myrta <jasiek@klaster.net>
To: Bruno Wolff III <bruno@wolff.to>
Cc: pgsql-sql@postgresql.org
Subject: Re: Does anyone use TO_CHAR(INTERVAL)?
Date: Wed, 26 Mar 2003 09:17:18 +0100
Message-ID: <3E81620E.20604@klaster.net> (raw)
In-Reply-To: <20030326044356.GA18525@wolff.to>
References: <200303250931.27351.josh@agliodbs.com>
<3E80AD07.5000005@klaster.net>
<20030326044356.GA18525@wolff.to>
Uz.ytkownik Bruno Wolff III napisa?:
> On Tue, Mar 25, 2003 at 20:24:55 +0100,
> Tomasz Myrta <jasiek@klaster.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: jasiek@klaster.net, bruno@wolff.to
Subject: Re: Does anyone use TO_CHAR(INTERVAL)?
In-Reply-To: <3E81620E.20604@klaster.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox