Home >Backend Development >PHP Tutorial > 关于时间戳与MYSQL有关问题

关于时间戳与MYSQL有关问题

WBOY
WBOYOriginal
2016-06-13 13:38:09692browse

关于时间戳与MYSQL问题
是这样的。我数据库里存放的是时间戳
我怎么得到此时间戳的日期和时间 有MYSQL语句可直接实现吗?
就是不用类似以下的方法:
foreach($data as $k=>$v){
  $data[$k]['time']=date('Y-m-d H:i:s',$v['time']);
}

------解决方案--------------------
SELECT FROM_UNIXTIME(1234567890, '%Y-%m-%d %H:%i:%s')
------解决方案--------------------

SQL code
SELECT FROM_UNIXTIME(`time`) as `time` FROM tablename; <div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn