WEEK()
WEEK(date
[,mode
])
Returns the week number for date
. If
passed the optional mode
parameter, the
week number returned will be modified according to Table D-3. You can also
use the function WEEKOFYEAR
, which
is equivalent to using the WEEK
function with a mode
of 3
. This code returns the week number
14:
SELECT WEEK('2016-04-04', 1);
Mode | First day of week | Range | Where week 1 is the first week ... |
0 | Sunday | 0–53 | with a Sunday in this year |
1 | Monday | 0–53 | with more than three days this year |
2 | Sunday | 1–53 | with a Sunday in this year |
3 | Monday | 1–53 | with more than three days this year |
4 | Sunday | 0–53 | with more than three days this year |
5 | Monday | 0–53 | with a Monday in this year |
6 | Sunday | 1–53 | with more than three days this year |
7 | Monday | 1–53 | with a Monday in this year |