Skip to content

WEEKOFYEAR

  • date: This parameter refers to the date value from which the week of the year is to be extracted. The date must be provided in a valid date format recognized by MySQL. WEEKOFYEAR() returns an integer value representing the week number of the provided date value within its respective year; this ranges from 0 to 53.
SELECT WEEKOFYEAR('2021-12-26') AS Week_Number;
+-------------+
| Week_Number |
+-------------+
| 52 |
+-------------+

The WEEKOFYEAR() function in MySQL returns the week number for a given date. The week number ranges from 0 to 53. In the example, the week number of ‘2021-12-26’ is 52.