Home >Database >Mysql Tutorial >mysql to_days函数用法实例

mysql to_days函数用法实例

WBOY
WBOYOriginal
2016-06-01 09:57:181639browse

TO_DAYS(date)

给定一个日期date,返回一个天数 (从年份0开始的天数)。MySQL“日期和时间类型”中的规则将日期中的二位数年份值转化为四位。例如,‘1997-10-07′和 ‘97-10-07′ 被视为同样的日期;对于1582 年之前的日期(或许在其它地区为下一年 ), 该函数的结果实不可靠的。

实例:

<code class="language-sql">SELECT TO_DAYS(  '2015-10-31' )</code>

得到的值:736267

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