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

Home -> Community -> Mailing Lists -> Oracle-L -> Months_between

Months_between

From: John Phan <johnphanz_at_hotmail.com>
Date: Mon, 16 Oct 2000 06:30:57 GMT
Message-Id: <10650.119276@fatcity.com>


Hi,
I've got some problems with my application. I have used "months_between" function of Oracle to calculate number of month between two days, but I really do not understand why the result is so strange. Could you explain to me what happend as follows:

SQL> select months_between('28/02/2001','28/11/2000') from dual;

MONTHS_BETWEEN('28/02/2001','28/11/2000')


                                         3

SQL> select months_between('28/02/2001','29/11/2000') from dual;

MONTHS_BETWEEN('28/02/2001','29/11/2000')


                                 2.9677419

SQL>select months_between('28/02/2001','30/11/2000') from dual;

MONTHS_BETWEEN('28/02/2001','30/11/2000')


                                         3

SQL>select months_between('28/02/2000','28/11/1999') from dual;

MONTHS_BETWEEN('28/02/2000','28/11/1999')


                                         3

SQL>select months_between('28/02/2000','29/11/1999') from dual;

MONTHS_BETWEEN('28/02/2000','29/11/1999')


                                 2.9677419

SQL>select months_between('28/02/2000','30/11/1999') from dual;

MONTHS_BETWEEN('28/02/2000','30/11/1999')


                                 2.9354839

Thanks for your help,

John.



Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at Received on Mon Oct 16 2000 - 01:30:57 CDT

Original text of this message

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