how to find previous date in php code example

Example 1: tomorrow date php

$tomorrow = date("Y-m-d", strtotime('tomorrow'));
or 
$tomorrow = date("Y-m-d", strtotime("+1 day"));

for DateTime
  
$datetime = new DateTime('tomorrow');
echo $datetime->format('Y-m-d H:i:s');

or

$datetime = new DateTime('2013-01-22');
$datetime->modify('+1 day');
echo $datetime->format('Y-m-d H:i:s');

Example 2: tomorro date php

$tomorrow = date("Y-m-d", strtotime('tomorrow'));
or 
$tomorrow = date("Y-m-d", strtotime("+1 day"));

for DateTime
  
$datetime = new DateTime('tomorrow');
echo $datetime->format('Y-m-d H:i:s');

or

$datetime = new DateTime('2013-01-22');
$datetime->modify('+1 day');
echo $datetime->format('Y-m-d H:i:s');

Tags:

Php Example