DEV Community


Posted on • Updated on

How to output tomorrow's date in PHP

Simply add a parameter called "+1 day" when instantiating the DataTime class.

// today
$today = new DateTime();
echo $today->format('Y-m-d') . PHP_EOL;
// tomorrow
$tomorrow = new DateTime('+1 day');
// or
$tomorrow = new DateTime('tomorrow');
echo $tomorrow->format('Y-m-d');
Enter fullscreen mode Exit fullscreen mode

Output result
Alt Text

Top comments (1)

nakato profile image
Mathieu Bernard

can use just : new DateTime('tomorrow');