How to add days to current date in php
In this tutorial, we will explain to you how to add days to current date in PHP. if you want to add days to the current date then you can easily add the days using PHP. so you can see our following example.
Add days to current date php
If you want to add days to current date then you can see the following example. here we use the date() function and strtotime() function for getting the current date and date convert into Unix timestamp. The following example code will add 7 days to current date.
Example
1 2 3 | <?php echo date('Y-m-d', strtotime(' + 7 days')); ?> |
Add days to specific date php
If you want to add days to a specific date then you can see the following example. The following example code will add 7 days to specific date.
Example
1 2 3 4 | <?php $date = "2021-08-10"; echo date('Y-m-d', strtotime($date. ' + 7 days')); ?> |
Output
1 | 2021-08-17 |
Read Also
Laravel 8 QR Code Generator Tutorial With Example
How To Check Form Validation In Php
Laravel 8 Vue JS Fullcalendar Example Tutorial