WEEKOFYEAR
Sintassi
WEEKOFYEAR(data)
Spiegazione
Restituisce la settimana del calendario corrispondente alla data indicata, che è un numero nell'intervallo che va da 1 a 53. WEEKOFYEAR()
è stata introdotta per motivi di compatibilità, ed è l'equivalente di WEEK(data,3)
.
Esempi
MariaDB [(none)]> SELECT WEEKOFYEAR('2008-02-20'); +--------------------------+ | WEEKOFYEAR('2008-02-20') | +--------------------------+ | 8 | +--------------------------+ 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 * from t1; +---------------------+ | d | +---------------------+ | 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 | +---------------------+ 6 rows in set (0.02 sec)
MariaDB [test]> SELECT d, WEEKOFYEAR(d), WEEK(d,3) from t1; +---------------------+---------------+-----------+ | d | WEEKOFYEAR(d) | WEEK(d,3) | +---------------------+---------------+-----------+ | 2007-01-30 21:31:07 | 5 | 5 | | 1983-10-15 06:42:51 | 41 | 41 | | 2011-04-21 12:34:56 | 16 | 16 | | 2011-10-30 06:31:41 | 43 | 43 | | 2011-01-30 14:03:25 | 4 | 4 | | 2004-10-07 11:19:34 | 41 | 41 | +---------------------+---------------+-----------+ 6 rows in set (0.00 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.