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
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号