Increment Month


/ Published in: PHP
Save to your folder(s)

Use this function if you need to get the same day in the next month (or how many you need).
Using defaults functions of php you got this:
echo date('Y-m-d', strtotime( " + 1 month " , strtotime('2010-01-31'))); (Output: '2010-03-03')

and if you use the function 'incrementsMonth', you got :
echo incrementsMonth('2010-01-31'); (Output: '2010-02-28')

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.