I want to compute the next Xth day in the calendar.
For example today is 2012-10-08. if X=25 i want it to return 2012-10-25 but if X=06 i want 2012-11-06. If the month doesn’t have the required X days, it must return the last day of the month (if i’m looking for the 30th of february for example, it must return 28 or 29 if leap year)
It seems simple enough but I get caught by all the special cases (last month of the year, 28-31 day months, etc).
You can use
strtotime()andt:HERE is a nice tutorial.