YEARWEEK()
YEARWEEK(date[,value])
This function returns the year coupled with the number of the
week into the year: yyyyww. By default, the
first day of the week is Sunday and is the basis of the calculation.
Optionally, you can set Monday as the first day of the week by
entering a value of 1 for the second argument. This function is
somewhat synonymous with WEEK(), but with the
year appended to the results and the mode of 2 for that function. If
you set the second parameter of this function to 1, it becomes similar
to WEEK() with the mode of 3. Here is an
example:
SELECT YEARWEEK('2008-01-07')
AS 'YearWeek';
+----------+
| YearWeek |
+----------+
| 200801 |
+----------+This function can be useful in conjunction with the PERIOD_ADD() and PERIOD_DIFF() functions.