Skip to main content
How to get a date before or after 7 days from the current date using php programming?
getting a date before 7 days using php programming
here is the code of to getting the date of 7 days before
simply copy and paste this code on your page and and run this file on browser.
<?php
$m= date("m"); // Month value
$de= date("d"); //today's date
$y= date("Y"); // Year value
echo date('Y-m-d', mktime(0,0,0,$m,($de-7),$y));
?>
Note: You can change the diffrence of date by changing the "($de-7)" 7 number to get according yourself.
you can also get a date after 7 days from the current date
<?php
$m= date("m"); // Month value
$de= date("d"); //today's date
$y= date("Y"); // Year value
echo date('Y-m-d', mktime(0,0,0,$m,($de+7),$y));
?>
Note: You can change the diffrence of date by changing the "($de+7)" 7 number to get according yourself.
Comments
Post a Comment