I have two columns in my db: start_date
and end_date
, which are both DATE
types. My code is updating the dates as follows:
I think this is similar to kouton's answer, but this one just takes in a timeStamp and returns a timestamp SOMEWHERE in the next month. You could use date("m", $nextMonthDateN) from there.
function nextMonthTimeStamp($curDateN){
$nextMonthDateN = $curDateN;
while( date("m", $nextMonthDateN) == date("m", $curDateN) ){
$nextMonthDateN += 60*60*24*27;
}
return $nextMonthDateN; //or return date("m", $nextMonthDateN);
}