Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: arithmetic on a DATE column?

Re: arithmetic on a DATE column?

From: C. Ferguson <c_ferguson_at_rationalconcepts.com>
Date: Fri, 20 Oct 2000 02:15:29 GMT
Message-ID: <39EFAB0A.A18505F3@rationalconcepts.com>

Hello,
  and from the sql manual (hint, hint, hint)

select to_char(add_months((sysdate+1), 12)) from dual;

hth,
cindy

sergio_rotstein_at_vpharm.com wrote:

> Please forgive me if this question has a blatantly obvious answer...
>
> I have a column in a table that contains dates on which I would like to
> do some arithmetic. Specifically, I would like to modify some of those
> dates by making "Date = Date + 1day + 4years". I know that an
> expression like date+1 would work to add one day to a given date, but
> how do I add the years? In my dream world I could use an expression
> like:
>
> SQL> select to_char(sysdate + to_date('1-4','D-Y')) from dual;
>
> but alas I know that doesn't work. I don't want to use an expression
> like "date + (365*4) + 1" because that doesn't correct for potential
> leap year issues...
>
> Any assistance would be most welcome.
>
> Thanks.
>
> Sergio.
>
> --
> Sergio H. Rotstein, Ph.D.
> Manager of Research Informatics
> Vertex Pharmaceuticals Incorporated
>
> --
> Sergio H. Rotstein, Ph.D.
> Manager of Discovery Information Systems
> Vertex Pharmaceuticals Incorporated
>
> --
> Sergio H. Rotstein, Ph.D.
> Manager of Discovery Information Systems
> Vertex Pharmaceuticals Incorporated
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Thu Oct 19 2000 - 21:15:29 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US