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:
Be careful, because sometimes strtotime("+1 months")
can skip month numbers.
Example:
$today = date("Y-m-d"); // 2012-01-30
$next_month = date("Y-m-d", strtotime("$today +1 month"));
If today is January, next month should be February which has 28 or 29 days, but PHP will return March as next month, not February.