Php SQL-选择unixtimestamp作为日期

Php SQL-选择unixtimestamp作为日期,php,mysql,sql,Php,Mysql,Sql,我正在尝试从数据库中选择unixtimestamp列作为可读日期时间: SELECT count(*) FROM users WHERE user_by="Admin" AND expire(FROM_UNIXTIME(unixtime),'%Y-%m-%d')='2015-10-02' 上面给出了这个错误: #1305 - FUNCTION database_maindb.expire does not exist 如何从列中选择unixtimestamp expire as dateti

我正在尝试从数据库中选择unixtimestamp列作为可读日期时间:

SELECT count(*) FROM users WHERE user_by="Admin" AND expire(FROM_UNIXTIME(unixtime),'%Y-%m-%d')='2015-10-02'
上面给出了这个错误:

#1305 - FUNCTION database_maindb.expire does not exist

如何从列中选择unixtimestamp expire as datetime,格式为:年-月-日期?

假设您的数据库字段名为expire:

SELECT count(*) FROM users WHERE user_by="Admin" AND FROM_UNIXTIME(expire,'%Y-%m-%d')='2015-10-02'

有关详细信息,请参见

您不需要选择is作为YMD日期戳,您可以执行一些操作,例如使用标签

$query = "SELECT * FROM `table`;";
$result = pdoObject->queryMethod($query);
$result= pdoObject->fetchAssocMethod($result);
$date = date("Y-m-d", $result['epochCol']);
我希望这有帮助