0
我有一个脚本,在我的mysql数据库中添加一个日期/时间戳的内容。无法为我更改输入日期/时间。sql增加时间显示
我想日期时间改变时,我查询了我的MySQL数据库。
细胞在我的数据库:2016年8月17日十七点34分29秒
它必须是:2016年8月17日19时34分29秒(以便+02:00小时PHP页面显示访问者)
我不能更新数据库中的时间,因为其他应用程序依赖于当前格式的数据。
提前致谢!
现在网站编码:
<?PHP
//make connection
mysql_connect('localhost','user','pass');
//select db
mysql_select_db('database');
?>
<html>
<head>
<title>Title</title>
</head>
<body>
<table>
<tr>
<th>id</th>
<th>disappear_time</th>
</tr>
<?php
$query_150="
SELECT * FROM `table`
WHERE `disappear_time` > SUBDATE(CURRENT_TIMESTAMP, INTERVAL 2 HOUR)
AND `id` = 150
ORDER BY `disappear_time` DESC";
$150 = mysql_query($query_150) or die(mysql_error());
while($row_150 = mysql_fetch_assoc($query_150)){
//handle rows.
echo "<tr>";
echo "<td>".$row_150['id']."</td>";
echo "<td>".$row_150['disappear_time']."</td>";
echo "</tr>";}
?>
</table>
</body>
</html>
您是否试过在'SELECT'语句中为'disappear_time'添加2个小时? –
最好的办法是做什么? – shadi1989
'disappear_time'什么含有你需要添加2小时并显示给用户的日期时间? –