I have a random starting date (e.g. 2012-09-19). I would like to be easily get the ending monthly cycles’ dates after this date. However, the monthly cycles are not exactly 30 days, but they are from date to date, e.g. 19 September to 19 October.
I would like to easily calculate the starting and ending date for, let’s say, the 5th or the 500the month after the subscription started, taking leap years into account. For example, if a subscription started on February 29 on a leap year and a non-leap year’s February comes, the ending date for the period should be February 28, without displacing future monthly cycles by one day.
This is quite easy it seems, using strtotime();
Let’s say the initial date is 2012-02-29.
Will result in 2016-04-29.