为时间戳添加时间
问题描述:
答
您可以使用Date::add这样:
<?php
$date = new DateTime('2011-10-09 10:29:23');
$date->add(new DateInterval('P20D')); //use PT20H for 20 hours
echo $date->format('Y-m-d H:i:s');
?>
答
http://www.php.net/manual/en/function.strtotime.php
使用PHP的像的strtotime功能:
$newtimestamp = strtotime("+20 days", $yourtimestamp);
答
我建议您使用unix_timestamps,这样您可以更快地工作,并且如果将时间显示给用户,则可以使用gmdate()。
答
与框架行之有效的另一种方法是
$time = date('Y-m-d H:i:s', time($foo->time_stamp + (24*60*60)));
在那里到底有多少是旧的PHP方法(*days*hours*mins*secs)
请点你为什么不能够找到解决你的问题[*上类似问题的大量问如何添加时间到日期](http://*.com/search?q=add+time+php)。此外,为什么这个标记的doctine和symfony的问题没有提到这些问题? – Gordon