日期:2014-05-17  浏览次数:20419 次

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
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
?