当前位置: 代码迷 >> PHP >> php 日期操作 天数添1
  详细解决方案

php 日期操作 天数添1

热度:198   发布时间:2012-06-30 17:20:12.0
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
?
  相关解决方案