add day to current date

Viewed 94991

add a day to date, so I can store tomorrow's date in a variable.

$tomorrow = date("Y-m-d")+86400;

I forgot.

6 Answers

You can use the add method datetime class. Eg, you want to add one day to current date and time.

$today = new DateTime();
$today->add(new DateInterval('P1D'));

Further reference php datetime add

Hope this helps.

I find mktime() most useful for this sort of thing. E.g.:

$tomorrow=date("Y-m-d", mktime(0, 0, 0, date("m"), date("d")+1, date("Y")));
Related