Home  >  Article  >  Backend Development  >  php date of the previous or next day_PHP tutorial

php date of the previous or next day_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:51:451331browse

Copy code The code is as follows:

date_default_timezone_set('PRC'); //Default time zone
echo "Today:",date("Y-m-d",time()),"
";
echo "Today:",date("Y-m-d",strtotime("18 june 2008")),"
"; 
echo "Yesterday:",date("Y-m-d",strtotime("-1 day")), "
"; 
echo "Tomorrow:",date(" Y-m-d",strtotime("+1 day")), "
"; 
echo "One week later:",date("Y-m-d",strtotime("+1 week")), "echo "One week, two days, four hours and two seconds later:", date("Y-m-d G:H:s",strtotime("+1 week 2 days 4 hours 2 seconds")), "< br>"; 
echo "Next Thursday:",date("Y-m-d",strtotime("next Thursday")), "
"; 
echo "Last Monday:".date( "Y-m-d",strtotime("last Monday"))."
"; 
echo "One month ago:".date("Y-m-d",strtotime("last month"))."echo "One month later:".date("Y-m-d",strtotime("+1 month"))."
"; 
echo "Ten years later:".date( "Y-m-d",strtotime("+10 year"))."
"; 
?>


php determines how many days are left between a date and today
Copy code The code is as follows:

echo (strtotime('2020-5-20′) -strtotime(date(“Y-m-d”)))/86400;
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/319056.htmlTechArticleCopy the code as follows: ?php date_default_timezone_set('PRC');//Default time zone echo "Today:", date("Y-m-d",time()),"br"; echo "Today:",date("Y-m-d",strtotime("18june2008")),"br"; e...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn