Re: to_char(interval) --- done? - Mailing list pgsql-hackers

From Larry Rosenman
Subject Re: to_char(interval) --- done?
Date
Msg-id 103270000.1048698403@lerlaptop.iadfw.net
Whole thread Raw
In response to Re: to_char(interval) --- done?  (Josh Berkus <josh@agliodbs.com>)
Responses Re: to_char(interval) --- done?  (Josh Berkus <josh@agliodbs.com>)
List pgsql-hackers

--On Wednesday, March 26, 2003 08:50:36 -0800 Josh Berkus 
<josh@agliodbs.com> wrote:

> Larry,
>
>> I had a need that should(!) be in the archives.  Just to reiterate my
>> need:
>>
>> I input a contract length, in months, and wanted to get it back out as
>> months.  There is no current way to do this, so I store it as an INT and
>> concatenate the word months to do the
>> date arithmetic.
>
> What about EXTRACT(months FROM <interval_field>)?
>
> This annoyingly wraps around if it's more than 12 months, but that was
> part of  my proposal ...
I needed like 5 years (60 months)...

So, the wrap around is not good in this case.

Thanks, though.


>
> --
> Josh Berkus
> Aglio Database Solutions
> San Francisco



-- 
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749



pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: to_char(interval) --- done?
Next
From:
Date:
Subject: Win32 Postgresql version.