Oracle Function MONTHS_BETWEEN

The Oracle/PLSQL MONTHS_BETWEEN function returns the number of months between date1 and date2.

Formula

MONTHS_BETWEEN( date1, date2 )
Parameter 

Date1
The first date used to calculate the number of months between.

Date2
The first date used to calculate the number of months between.

Example 1
select months_between(to_date('201608','yyyymm'),to_date('201607','yyyymm'))  from dual;
// output 1

Example 2

select months_between(to_date('201608','yyyymm'),to_date('201606','yyyymm'))  from dual;
// output 2






Share on Google Plus

About sparraymark8

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Thanks for your post. It helps me to solve my problems.

    ReplyDelete