mnth = DateDiff(DateInterval.Month, 8/30/2012, 10/1/2012)
gives mnth = 2. But when we look, there is only 32 days between these dates. I am expecting a result mnth=1 as there is only 32 days between these days.
Pls help..
In my scenario i can consider a 15+ days to be a month but if it is less than 15, it should’nt be considered.
To get the number of complete months you can do different things depending on your interpretation,
With this function the number of complete months between 31/05/2011 (dd/mm/yy) and 30/06/2011 is 0 but between 30/06/2011 and 31/07/2011 is 1. Which may or may not be what you expect.
With this function the ratio
Day / DaysInMonthis taken so the relative completion of the two months can be assessed.This function only rounds down if the surplus days are less than the magic number 15, which I think is what you are asking for in your update.
This function takes the simpler approach of dividing the total number of days by the average number of days per month in the Gregorian Calendar.