gpt4 book ai didi

php - 无法获取当前时间戳

转载 作者:行者123 更新时间:2023-11-29 21:02:04 25 4
gpt4 key购买 nike

需要帮助从数据库中获取时间戳。时间戳 = 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

我需要这个来显示 EST,它当前显示的是 UTC 时间

最佳答案

如果偏移量始终相同,您只需修改输出并将数据库中的时间戳保留为 UTC:

 DATE_ADD(timestamp, INTERVAL 2 HOUR)

关于php - 无法获取当前时间戳,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37131963/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com