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

mysql DAYOFWEEK 和 WEEKDAY获取星期

WBOY
Release: 2016-06-01 09:57:18
Original
2202 people have browsed it

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

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

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>
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