关于时间戳与MYSQL有关问题

WBOY
Release: 2016-06-13 13:38:09
Original
657 people have browsed it

关于时间戳与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>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!