PHP date arithmetic

strtotime() function can be used for date arithmetic. Following are some examples:

Get next date

print date('Y-m-d', strtotime('+1 day', strtotime('2013-09-30')));

Prints

2013-10-01

Get previous month

print date('Y-m-d', strtotime('-1 month', strtotime('2013-09-30')));

Prints

2013-08-30

Go back 5 years

print date('Y-m-d', strtotime('-5 year', strtotime('2013-09-30')));

Prints

2013-04-30
Technologies: