WEEKDAY
Sintassi
WEEKDAY(data)
Spiegazione
Restituisce il numero del giorno della settimana corrispondente alla data indicata
(0
= lunedì, 1
= martedì, ... 6
= sabato).
Ciò differisce da DAYOFWEEK()
, che segue lo standard ODBC
(1
= domenica, 2
= lunedì, ..., 7
= sabato).
Esempi
MariaDB [(none)]> SELECT WEEKDAY('2008-02-03 22:23:00'); +--------------------------------+ | WEEKDAY('2008-02-03 22:23:00') | +--------------------------------+ | 6 | +--------------------------------+ 1 row in set (0.00 sec) MariaDB [(none)]> SELECT WEEKDAY('2007-11-06'); +-----------------------+ | WEEKDAY('2007-11-06') | +-----------------------+ | 1 | +-----------------------+ 1 row in set (0.00 sec) MariaDB [(none)]>
CREATE TABLE t1 (d DATETIME); INSERT INTO t1 VALUES ("2007-01-30 21:31:07"), ("1983-10-15 06:42:51"), ("2011-04-21 12:34:56"), ("2011-10-30 06:31:41"), ("2011-01-30 14:03:25"), ("2004-10-07 11:19:34");
MariaDB [test]> SELECT d FROM t1 where WEEKDAY(d) = 6; +---------------------+ | d | +---------------------+ | 2011-10-30 06:31:41 | | 2011-01-30 14:03:25 | +---------------------+ 2 rows in set (0.02 sec)
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.