Name

WEEKOFYEAR( )

Synopsis

WEEKOFYEAR(date)

This function returns the calendar week of the year for the given date. This function was added in Version 4.1.1 of MySQL.

SELECT CURDATE( ) AS Date,
       WEEKOFYEAR(CURDATE( )) AS Week;
+------------+------+
| Date       | Week |
+------------+------+
| 2005-01-11 |    2 |
+------------+------+

Get MySQL in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.