Home >Backend Development >PHP Tutorial > php 日期操作 天数添1

php 日期操作 天数添1

WBOY
WBOYOriginal
2016-06-13 13:25:591356browse

php 日期操作 天数加1

?

?

#给定一个日期:
$s= '2012-05-28 14:23:43';

#在这个日期上加上1天 得到新日期

echo date('Y-m-d H:i:s',strtotime("$s +1 day"));

#输出 2012-05-29 14:23:43
<pre class="php" name="code">4.strstotime()函数转化时间戳

echo(strtotime("now")); //1138614504
echo(strtotime("3 October 2005")); //1128290400
echo(strtotime("+5 hours")); //1138632504
echo(strtotime("+1 week")); //1139219304
echo(strtotime("+1 week 3 days 7 hours 5 seconds")); //1139503709
echo(strtotime("next Monday")); //1139180400
echo(strtotime("last Sunday")); //1138489200
?
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