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 -> Funky add_months() results...

Funky add_months() results...

From: <michaelaustininc_at_my-deja.com>
Date: Wed, 08 Sep 1999 13:44:06 GMT
Message-ID: <7r5p73$ecu$1@nnrp1.deja.com>


Connected to:
Oracle7 Server Release 7.3.4.0.0 - Production With the distributed and parallel query options PL/SQL Release 2.3.4.0.0 - Production

The following query adds 100 years (1,200 months) to a given date (27-FEB-1900 in this case) and returns the new value:

select to_char(

              add_months(
                        to_date(

'27-FEB-1900',
'DD-MON-YYYY'
), 1200 ), 'DD-MON-YYYY' )from dual;

As written, it returns 27-FEB-2000 (as would be expected). But if I replace the date with 28-FEB- 1900, it returns 29-FEB-2000. (01-MAR-1900 returns 01-MAR-2000, as it should.) What happened to 28-Feb-2000?

Michael Austin
Michael Austin, Inc.
An Independent Database Consulting Firm michaelaustininc_at_hotmail.com

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Wed Sep 08 1999 - 08:44:06 CDT

Original text of this message

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