Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

months_between problem

161787Mar 13 2008 — edited Mar 17 2008
Hello all,

select add_months(to_date('30-may-2007'), 9) from dual;
I got 29-FEB-2008.

Then,
select months_between(to_date('29-FEB-2008'), to_date('30-may-2007'))
from dual;
I got 8.97, it is not exact 9 months.

I think it is related to leap year. But my codes need to get exact 9 months to date, I can't use round.

How should I do?

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 14 2008
Added on Mar 13 2008
9 comments
904 views