MySQL Tutorial/Date Time Functions/WEEK
WEEK(date[,mode]) returns the week number for date
The mode specifies whether the week starts on Sunday or Monday.
If the mode argument is omitted, the value of the default_week_format system variable is used.
The mode could be 0 ,1 ,2 ,3 ,4 ,5 ,6 ,7
mysql>
mysql> SELECT WEEK("1998-02-20");
+--------------------+
| WEEK("1998-02-20") |
+--------------------+
| 7 |
+--------------------+
1 row in set (0.00 sec)
mysql> SELECT WEEK("1998-02-20",0);
+----------------------+
| WEEK("1998-02-20",0) |
+----------------------+
| 7 |
+----------------------+
1 row in set (0.00 sec)
mysql> SELECT WEEK("1998-02-20",1);
+----------------------+
| WEEK("1998-02-20",1) |
+----------------------+
| 8 |
+----------------------+
1 row in set (0.00 sec)
mysql> SELECT WEEK("1998-12-31",1);
+----------------------+
| WEEK("1998-12-31",1) |
+----------------------+
| 53 |
+----------------------+
1 row in set (0.02 sec)
mysql> SELECT WEEK("2000-01-01",2);
+----------------------+
| WEEK("2000-01-01",2) |
+----------------------+
| 52 |
+----------------------+
1 row in set (0.00 sec)
mysql>
WEEK(date), parameter, returns the week of the year in the range 0 to 53:
mysql>
mysql> SELECT WEEK("2001-12-26");
+--------------------+
| WEEK("2001-12-26") |
+--------------------+
| 51 |
+--------------------+
1 row in set (0.00 sec)
mysql>