I want to calculate, using PHP or MySQL, the number of calendar months that are encompassed between two dates.
For example:
February 3, 2015 (2015-02-03) and April 10, 2015 (2015-04-10) would be three months (February, March, April. Also, February 28, 2015 (2015-02-28) and April 1, 2015 (2015-04-01) would be three months (February, March, April).
So the actual number of calendar months don't really matter... I just want to know how many months on a calendar fall between two months.
I can't come up with a simple/elegant way to do this with PHP or MySQL.
Try this:
demo
You can use this to get total months between two dates
Hope this helps. Thanks.