How to get next and previous day in php

get next and previous day in php

<?php
$date = isset($_GET[‘date’]) ? $_GET[‘date’] : date(‘Y-m-d’);
$prev_date = date(‘Y-m-d’, strtotime($date .’ -1 day’));
$next_date = date(‘Y-m-d’, strtotime($date .’ +1 day’));
?>

<a href=”?date=<?=$prev_date;?>”>Previous</a>
<a href=”?date=<?=$next_date;?>”>Next</a>

Please follow and like us:
0

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.