Home > Backend Development > PHP Tutorial > 运用日期升序来排序,而且日期必须大于0

运用日期升序来排序,而且日期必须大于0

WBOY
Release: 2016-06-13 10:36:43
Original
1114 people have browsed it

使用日期升序来排序,而且日期必须大于0
日期字段使用的是时间戳格式,想按照升序来排列,而且日期必须是大于零的。不知道程序应该怎么实现?最好是简单的方法,谢谢。

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

SQL code
... WHERE `日期` > 0 ORDER BY `日期` ASC<br><font color="#e78608">------解决方案--------------------</font><br>select * from t where `time`>0 order by `time` asc;<br><font color="#e78608">------解决方案--------------------</font><br>时间戳 等于 0<br>表示的是 1970-01-01 00:00:00 这一时刻<br>之前的为负,之后的为正<br><br>至于“会把日期为0的都过滤掉的”,难道不对吗?<br>你不是要求“想按照升序来排列,而且日期必须是大于零的”的吗?<br><br>难道这个 零 不是 0,还有特殊含义吗?<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