Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: date data manipulation
In article <5jl5r2$nk$1_at_cronkite.seas.gwu.edu>,
Shaochun Lin <lovedog_at_gwis2.circ.gwu.edu> wrote:
>I am a bit confused about how to caculate the date.
>Such as how old a person. How the date handle the
>addition and subtraction. Such as if you have
>column A (date type) and column B(date type). If you
>do A+B and A-B or even sum(A). Could someone enlighten
>me a little bit. Thank,SC Lin,
A+B and sum(A) don't make any sense. About the only useful date calculation is a difference, as in A-B. This gives the number of days between two dates. The result may include a fraction, if A or B contain different times of the day.
Try it for yourself in SQL Plus:
select to_date('19970430','yyyymmdd')-sysdate "Days" from dual;
Days
Steve Cosner Received on Fri Apr 25 1997 - 00:00:00 CDT