在我的Mysql表中,我有一个时间戳字段。 在我的php页面中,我以以下方式显示记录($row[data])
echo date("d-m-Y H:i:s", strtotime($row['data']));
现在我想在我的php代码中将日期增加1小时。如何实现这个功能?谢谢。
在我的Mysql表中,我有一个时间戳字段。 在我的php页面中,我以以下方式显示记录($row[data])
echo date("d-m-Y H:i:s", strtotime($row['data']));
现在我想在我的php代码中将日期增加1小时。如何实现这个功能?谢谢。
echo date("d-m-Y H:i:s", strtotime($row['data'])+3600);
SELECT `date` + INTERVAL 1 HOUR AS `date`
FROM ...
echo date("d-m-Y H:i:s", strtotime($row['data'].' +1 hour'));
尝试使用:
strtotime($row['data'] . ' +1 hour')
echo date("d-m-Y H:i:s", strtotime($row['data']) + 3600);
只需手动添加时间(3600秒=1小时)。
加上3600秒,你就没问题了。
echo date("d-m-Y H:i:s", strtotime($row['data'])+3600);
$date1 > $date2
返回TRUE!谢谢。 - Paolo Rossi