Get previous and next day with PHP

Use the following code for current date with different format

Input:
<?php
echo "Today is " . date("Y/m/d") . "<br>";
 
echo "Today is " . date("Y.m.d") . "<br>";
echo "Today is " . date("Y-m-d") . "<br>";
echo "Today is " . date("l");
?>
Output:
Today is 2020/09/15
Today is 2020.09.15
Today is 2020-09-15
Today is Tuesday

Use the following for previous date Tomorrow

Input:
<?php
echo "Yesterday Date: " . date('Y-m-d', strtotime(' -1 day'));
?>
Output:
Tomorrow Date: 2020-09-14

Use the following for next date 

Input:
<?php
echo "Tomorrow Date: " . date('Y-m-d', strtotime(' +1 day'));
?>
Output:
Tomorrow Date: 2020-09-16
Get previous and next day with PHP
About author
Robin
Robin
PHP Developer
0 comments
Be a First Comment
Add Your Comment