Using a combination of the date() and strtotime() PHP functions you can add easily add or subtract date periods from a string date.
$date = date("Y-m-d");// current date
$add1day = strtotime(date("Y-m-d", strtotime($date)) . " +1 day");
$add1week = strtotime(date("Y-m-d", strtotime($date)) . " +1 week");
$sub2days = strtotime(date("Y-m-d", strtotime($date)) . " -2 day");
$add1month = strtotime(date("Y-m-d", strtotime($date)) . " +1 month");
$add30days = strtotime(date("Y-m-d", strtotime($date)) . " +30 days");
The following is a simple list of the various types of formating available to the date() function.
Time:
a: am or pm depending on the time
A: AM or PM depending on the time
g: Hour without leading zeroes. Values are 1 through 12.
G: Hour in 24-hour format without leading zeroes. Values are 0 through 23.
h: Hour with leading zeroes. Values 01 through 12.
H: Hour in 24-hour format with leading zeroes. Values 00 through 23.
i: Minute with leading zeroes. Values 00 through 59.
s: Seconds with leading zeroes. Values 00 through 59.
Day:
d: Day of the month with leading zeroes. Values are 01 through 31.
j: Day of the month without leading zeroes. Values 1 through 31
D: Day of the week abbreviations. Sun through Sat
l: Day of the week. Values Sunday through Saturday
w: Day of the week without leading zeroes. Values 0 through 6.
z: Day of the year without leading zeroes. Values 0 through 365.
Month:
m: Month number with leading zeroes. Values 01 through 12
n: Month number without leading zeroes. Values 1 through 12
M: Abbreviation for the month. Values Jan through Dec
F: Normal month representation. Values January through December.
t: The number of days in the month. Values 28 through 31.
Year:
L: 1 if it’s a leap year and 0 if it isn’t.
Y: A four digit year format
y: A two digit year format. Values 00 through 99.
Other Formatting:
U: The number of seconds since the Unix Epoch (January 1, 1970)