How can I add months to a date string such as 201308 (for August 2013) and return it in the same format, ie 201408 (for August 2014)? I’ve tried:
$dateToDflt = "201308";
$dateToDflt = strtotime(date("Ym", strtotime($dateToDflt)) . " +12 months");
$dateToDflt = date("Ym",$dateToDflt);
This just brings back 12 months ahead of the today’s date so I think I’m getting my time and date formats confused
Or simple string manipulation including casting
Of course works only for years 2010 to 2018. To extend to range to 2098, add this 😉
http://codepad.org/43LACMoZ 😉