How to use PHP & DateAdd This function will be using PHP and using function DateAdd()
ShotDev Focus:
- PHP & DateAdd()
Example
php_dateadd.php
<html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <?php echo date('Y-m-d',strtotime('+1 month'))."<br>"; echo date('Y-m-d',strtotime("now"))."<br>"; echo date('Y-m-d',strtotime("10 September 2000"))."<br>"; echo date('Y-m-d',strtotime("+1 day"))."<br>"; echo date('Y-m-d',strtotime("+1 week"))."<br>"; echo date('Y-m-d',strtotime("+1 week 2 days 4 hours 2 seconds"))."<br>"; echo date('Y-m-d',strtotime("next Thursday"))."<br>"; echo date('Y-m-d',strtotime("last Monday"))."<br>"; echo date("Y-m-d H:i:s", mktime(date("H"), date("i")+0, date("s")+0, date("m")+0 , date("d")+0, date("Y")+0))."<br>"; ?> </body> </html>
Create a php file and save to path root-path/myphp/
Run
http://localhost/myphp/php_dateadd.php
Screenshot