I need to input a date in format, 26/12/1993 where 12 is month (december), I need to know a way to find the previous date (25/12/1993) and the next date (27/12/1993) using PHP.
Asked
Active
Viewed 157 times
2 Answers
1
Please check the below example:
<a href="home.php?date=<?= date('Y-m-d', strtotime(' -1 day')) ?>" class="prev_day" title="Previous Day" ></a>
<a href="home.php?date=<?= date('Y-m-d', strtotime(' +1 day')) ?>" class="next_day" title="Next Day" ></a>
It might help you.
take a look at get next and previous day with php

Community
- 1
- 1

Shreyos Adikari
- 12,348
- 19
- 73
- 82
0
Try using the PHP DateTime object
$date = new DateTime('26/12/1993');
$previous_day = $date->modify('-1 day');
$next_day = $date->modify('+1 day');
print $previous_day->date_format('m/d/Y');
print $next_day->date_format('m/d/Y');

RMcLeod
- 2,561
- 1
- 22
- 38