Skip site navigation (1) Skip section navigation (2)

Re: to_char(interval) --- done?

From: Larry Rosenman <ler(at)lerctr(dot)org>
To: Josh Berkus <josh(at)agliodbs(dot)com>, Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
Cc: pgsql-hackers(at)postgresql(dot)org, Peter Eisentraut <peter_e(at)gmx(dot)net>
Subject: Re: to_char(interval) --- done?
Date: 2003-03-26 17:06:43
Message-ID: 103270000.1048698403@lerlaptop.iadfw.net (view raw or flat)
Thread:
Lists: pgsql-hackers

--On Wednesday, March 26, 2003 08:50:36 -0800 Josh Berkus 
<josh(at)agliodbs(dot)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(at)lerctr(dot)org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749


In response to

Responses

pgsql-hackers by date

Next:From: opensourceDate: 2003-03-26 17:49:03
Subject: Win32 Postgresql version.
Previous:From: Josh BerkusDate: 2003-03-26 16:50:36
Subject: Re: to_char(interval) --- done?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group