Home  >  Article  >  Backend Development  >  strtotime use

strtotime use

WBOY
WBOYOriginal
2016-08-08 09:27:241062browse
获取当前时间或者任一时间加上任一天数 并转换成日期格式
1、
$date = date('Y-m-d H:i:s',strtotime('+4 days));
//说明:strtotime 的第二个参数为空,默认取值 time();
2、
$time = strtotime(date('2015-03-01 H:i:s));//指定任一时间并转换成时间戳

$date= date("Y-m-d H:i:s", strtotime("+5 days", $time));//在指定时间加上任意天数并转换成日期格式

The above introduces the use of strtotime, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.

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
Previous article:Using SVN under UbuntuNext article:Using SVN under Ubuntu