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

mysql 的 datediff 使用_MySQL

WBOY
WBOYOriginal
2016-06-01 13:07:541356browse

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


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

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

result1                       result2

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

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