Home > Database > Mysql Tutorial > mysql DAYOFMONTH,DAYOFYEAR,MONTH等函数应用实例

mysql DAYOFMONTH,DAYOFYEAR,MONTH等函数应用实例

WBOY
Release: 2016-06-01 09:57:17
Original
1651 people have browsed it

DAYOFMONTH(date) 
返回date的月份中日期,在1到31范围内。

<code class="language-sql">mysql> select DAYOFMONTH('1998-02-03'); 
-> 3</code>
Copy after login

DAYOFYEAR(date) 
返回date在一年中的日数, 在1到366范围内。

<code class="language-sql">mysql> select DAYOFYEAR('1998-02-03'); 
-> 34</code>
Copy after login

MONTH(date) 
返回date的月份,范围1到12。

<code class="language-sql">mysql> select MONTH('1998-02-03'); 
-> 2</code>
Copy after login

DAYNAME(date) 
返回date的星期名字。

<code class="language-sql">mysql> select DAYNAME("1998-02-05"); 
-> 'Thursday'</code>
Copy after login

MONTHNAME(date) 
返回date的月份名字。

<code class="language-sql">mysql> select MONTHNAME("1998-02-05"); 
-> 'February'</code>
Copy after login

QUARTER(date) 
返回date一年中的季度,范围1到4。

<code class="language-sql">mysql> select QUARTER('98-04-01'); 
-> 2</code>
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