Home > Database > Mysql Tutorial > mysql 的 datediff 使用_MySQL

mysql 的 datediff 使用_MySQL

WBOY
Release: 2016-06-01 13:07:54
Original
1361 people have browsed it

在mysql中就完全相反,你若想得到一个正数结果,那第一个日期应该填结束日期,第二个参数应该填开始日期,很奇葩的设计。


select datediff('2013-01-01','2013-01-02') result1, datediff('2013-01-02','2013-01-01') result2;

-------------------------------------------------------------------------------------------------------------------------------

result1                       result2

--------                        -----------
-1                                1

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