Code :
<?php echo date('Y/m/d'); ?>
Echo : 2022/03/18
what i need is adding 3 days of the current day
any possible solution ?
Exemple :
the code will echo this :
2022/03/21
<?php echo Date('y:m:d', strtotime('+3 days')); ?>
<?php
$date = date('Y/m/d');
echo date('Y-m-d', strtotime($date. ' + 3 days'));
Also there is a \Datetime class in PHP:
https://www.php.net/manual/en/class.datetime.php
https://www.php.net/manual/en/function.strtotime.php
You can for instance say:
+ 1 week
or
+ 2 days
or
- 3 years
The date() function gives the date string in specified format. So if on 31 december 2022 you say "+ 1 day" the date becomes 1 januari 2023.
If you then echo date("Y", strtotime("31 december 2022 + 1 day"))
it will say "2023"