How to return a month based on unusual month start dates and end dates?

Here is the thread I found pertaining to this exact problem.