Re: Arithmetic on DATE type

From: Mark J. Bobak <mbobak_at_tr1106.to.ford.com>
Date: 8 Jul 1994 17:20:06 GMT
Message-ID: <2vk1s6INNc7v_at_ope001.iao.ford.com>


In article <d7hansl.773681116_at_dtek.chalmers.se>, Hans Lindberg <d7hansl_at_dtek.chalmers.se> wrote:
>Are there any nice functions that operate on DATE type variables?
>I'd like to be able to for example add one day to a certain date.
>Adding " to_date('24','HH24') " doesn't work as " + " doesn't accept
>date type operands. Do I have to convert it to a string and manipulate
>it the hard way? Are there any PD librarys around on the net?

Hmmm.....either you're overlooking the obvious, or I'm missing what you're trying to do. Here are some examples of what I *think* you want to do:

first, today's date:

SQL*Plus> select sysdate from dual;  

SYSDATE



08-JUL-94 Add a day for tomorrow,

SQL*Plus> select sysdate + 1 from dual;  

SYSDATE+1



09-JUL-94 add a week,

SQL*Plus> select sysdate + 7 from dual;  

SYSDATE+7



15-JUL-94 add a day to an arbitrary date,

SQL*Plus> select to_date('28-FEB-88') + 1 from dual;  

TO_DATE('



29-FEB-88 add a week to an arbitrary date,

SQL*Plus> select to_date('28-FEB-88') + 7 from dual;  

TO_DATE('



06-MAR-88  
-- 
Mark J. Bobak
Truck Operations
Ford Motor Company
bobak_at_mailhost.to.ford.com
Received on Fri Jul 08 1994 - 19:20:06 CEST

Original text of this message