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


MySQL TUTORIALS » 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') |
+--------------------+
|                  |
+--------------------+
row in set (0.00 sec)

mysql> SELECT WEEK('1998-02-20',0);
+----------------------+
| WEEK('1998-02-20',0|
+----------------------+
|                    |
+----------------------+
row in set (0.00 sec)

mysql> SELECT WEEK('1998-02-20',1);
+----------------------+
| WEEK('1998-02-20',1|
+----------------------+
|                    |
+----------------------+
row in set (0.00 sec)

mysql> SELECT WEEK('1998-12-31',1);
+----------------------+
| WEEK('1998-12-31',1|
+----------------------+
|                   53 |
+----------------------+
row in set (0.02 sec)

mysql> SELECT WEEK('2000-01-01',2);
+----------------------+
| WEEK('2000-01-01',2|
+----------------------+
|                   52 |
+----------------------+
row in set (0.00 sec)

mysql>



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

MySQL TUTORIALS

 Navioo Date Time Functions
» WEEK