Home > Backend Development > PHP Tutorial > 字段存的是时间戳如何取当天的所有记录 SQL如何写

字段存的是时间戳如何取当天的所有记录 SQL如何写

WBOY
Release: 2016-06-13 10:12:10
Original
967 people have browsed it

字段存的是时间戳怎么取当天的所有记录 SQL怎么写
字段存的是时间戳怎么取当天的所有记录 SQL怎么写

------解决方案--------------------

SQL code
SELECT * from table where DATE(FROM_UNIXTIME(time))=DATE(NOW());<br><font color="#e78608">------解决方案--------------------</font><br><br>
Copy after login
SQL code
SELECT * FROM table WHERE DATE(FROM_UNIXTIME(time))=CURDATE();<br><font color="#e78608">------解决方案--------------------</font><br>
Copy after login
SQL code
SELECT * FROM table WHERE FROM_UNIXTIME(TIME, '%Y-%m-%d' ) =CURDATE();<br><font color="#e78608">------解决方案--------------------</font><br>以上写法均不推荐:<br><br>select * from `table` where `time` >= curdate()<br><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