MySQL Tutorial/Date Time Functions/YEARWEEK — различия между версиями

Материал из SQL эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Версия 13:44, 26 мая 2010

SELECT MID(YEARWEEK("2000-01-01"),5,2);

mysql>
mysql> SELECT MID(YEARWEEK("2000-01-01"),5,2);
+---------------------------------+
| MID(YEARWEEK("2000-01-01"),5,2) |
+---------------------------------+
| 52                              |
+---------------------------------+
1 row in set (0.00 sec)
mysql>


SELECT YEARWEEK("2000-01-01");

mysql>
mysql> SELECT YEARWEEK("2000-01-01");
+------------------------+
| YEARWEEK("2000-01-01") |
+------------------------+
|                 199952 |
+------------------------+
1 row in set (0.00 sec)
mysql>


YEARWEEK(date), YEARWEEK(date,mode) returns year and week for a date.

The mode could be 0 ,1 ,2 ,3 ,4 ,5 ,6 ,7.



mysql>
mysql> SELECT YEARWEEK("1987-01-01");
+------------------------+
| YEARWEEK("1987-01-01") |
+------------------------+
|                 198652 |
+------------------------+
1 row in set (0.00 sec)
mysql>