WEEK(date[,mode]) returns the week number for date : WEEK « Date Time Functions « MySQL Tutorial






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>








14.55.WEEK
14.55.1.WEEK(date[,mode]) returns the week number for date
14.55.2.WEEK(date), parameter, returns the week of the year in the range 0 to 53: