需要帮助从数据库中提取时间戳。 timestamp = CURRENT_TIMESTAMP 我需要它来显示我们当前的时区EST时间。需要帮助这样做。
当前查询
mysql_select_db($database_localhost, $localhost);
$query_leadsscott = "SELECT * FROM leads WHERE marketer = 'scott' ORDER BY `timestamp` DESC";
$leadsscott = mysql_query($query_leadsscott, $localhost) or die(mysql_error());
$row_leadsscott = mysql_fetch_assoc($leadsscott);
$totalRows_leadsscott = mysql_num_rows($leadsscott);`
' <h6>Marketing Reports for Emily</h6>
<table border="1">
<tr>
<td>Timestamp</td>
<td>Marketer</td>
<td>Facility</td>
<td>Name</td>
<td>Type</td>
<td>Description</td>
<td>Cocality</td>
<td>State</td>
<td>Zip</td>
<td>Latlng</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_leadsemily['timestamp']; ?></td>
<td><?php echo $row_leadsemily['marketer']; ?></td>
<td><?php echo $row_leadsemily['facility']; ?></td>
<td><?php echo $row_leadsemily['name']; ?></td>
<td><?php echo $row_leadsemily['type']; ?></td>
<td><?php echo $row_leadsemily['description']; ?></td>
<td><?php echo $row_leadsemily['locality']; ?></td>
<td><?php echo $row_leadsemily['state']; ?></td>
<td><?php echo $row_leadsemily['zip']; ?></td>
<td><a href="https://www.google.com/maps/place/<?php echo $row_leadsemily['latlng']; ?>"> Link </a></td>
</tr>
<?php } while ($row_leadsemily = mysql_fetch_assoc($leadsemily)); ?>
</table>'
显示报告时间的时间戳如下
时间戳
2016-05-09 13:16:57
我需要这个以显示它当前正在显示UTC时间的EST
答案 0 :(得分:0)
删除此
ORDER BY timestamp
DESC
,然后检查查询。如果此方法工作正常,则按如下方式对时间戳进行排序
order by year DESC, month DESC, day DESC"
答案 1 :(得分:0)
如果偏移量始终相同,您只需修改输出并将数据库中的时间戳保留为UTC:
DATE_ADD(timestamp, INTERVAL 2 HOUR)