WEEK (date[,mode])
The function returns the week number for date. The two-argument form
of WEEK () allows you to specify whether the week starts on Sunday or
Monday and whether the return value should be in the range from 0 to
53 or from 1 to 53. If the mode argument is
omitted, the value of the default_week_format system variable is
used (or 0 before MySQL 4.0.14).
See also : [Server system variables].
The following table describes how the mode argument works:
First day
Mode of week Range Week 1 is the first week...
0 Sunday 0-53 with a Sunday in this year
1 Monday 0-53 with more than 3 days this year
2 Sunday 1-53 with a Sunday in this year
3 Monday 1-53 with more than 3 days this year
4 Sunday 0-53 with more than 3 days this year
5 Monday 0-53 with a Monday in this year
6 Sunday 1-53 with more than 3 days this year
7 Monday 1-53 with a Monday in this year
A mode value of 3 can be used as of MySQL 4.0.5.
Values of 4 and above can be used as of MySQL 4.0.17.