[英]UNIX_TIMESTAMP(timestamp) use
i am trying to acquire unix_timestamp value for a particular timestamp column. 我试图获取特定时间戳列的unix_timestamp值。 but i am confused.
但是我很困惑。
$timecheck = mysql_query("SELECT UNIX_TIMESTAMP(datetime) FROM machine where m_id = $m_id");
if (mysql_num_rows($timecheck) > 0){
while ($timefetch = mysql_fetch_object($timecheck)) {
echo $timefetch->datetime;
print_r($timefetch[0]->datetime);
if (($timefetch->datetime - time()) > 6000){
echo "1";
}
else {
echo "0";
}
}
the timestamp value returned is an stdClass object. 返回的时间戳值是stdClass对象。 cannot use it to compare.
无法使用它进行比较。 can someone please help me with the below code
有人可以帮我下面的代码吗
在SQL查询中为列名使用别名:
SELECT UNIX_TIMESTAMP(datetime) AS datetime FROM machine where m_id = $m_id
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.