Home >Database >Mysql Tutorial >mysql DAYOFWEEK 和 WEEKDAY获取星期

mysql DAYOFWEEK 和 WEEKDAY获取星期

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

DAYOFWEEK(date) 
返回日期date的星期索引(1=星期天,2=星期一, ……7=星期六)。这些索引值对应于ODBC标准。

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

WEEKDAY(date) 
返回date的星期索引(0=星期一,1=星期二, ……6= 星期天)。

<code class="language-sql">mysql> select WEEKDAY('1997-10-04 22:23:00'); 
-> 5 
mysql> select WEEKDAY('1997-11-05'); 
-> 2</code>

 

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