Home >php教程 >php手册 >php中时间加减法

php中时间加减法

WBOY
WBOYOriginal
2016-06-06 19:59:461617browse

//2014-07-15 加一天的日期 $tomorrow=date(’Y-m-d’,strtotime(2014-07-15 1day)); echo$tomorrow;//2014-07-16 $yestoday = date('Y-m-d',strtotime(2014-07-15 - 1day)); echo $yestoday; //2014-07-14 年、月、星期也可以加下试试

// 2014-07-15 加一天的日期    
$tomorrow = date(’Y-m-d’,strtotime("2014-07-15 + 1 day"));    

echo $tomorrow; // 2014-07-16  

$yestoday = date('Y-m-d',strtotime("2014-07-15 - 1day"));

echo $yestoday; //2014-07-14

年、月、星期也可以加下试试

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