Calculate the number of months between two dates

Tools & Utilities
Enthusiast

Calculate the number of months between two dates

Does anyone know the best way to do this?
2 REPLIES
Junior Contributor

Re: Calculate the number of months between two dates

Use ANSI SQL interval arithmetic:

select (date1 - date2) month(4)

Dieter
Enthusiast

Re: Calculate the number of months between two dates

Hi,
This is one of the way to do it.
Make the use of the table sys_calendar.calendar.

Example:
select a.month_of_calendar-b.month_of_calendar from sys_calendar.calendar a,sys_calendar.calendar b
where a.calendar_date='2006-10-10' and b.calendar_date='2005-10-10'
Ans:12

Regards,
Aravind