Skip to main content
Version: Latest-4.0

weekofyear

Returns the week number for a given date within a year.

The date parameter must be of the DATE or DATETIME type.

Syntax​

INT WEEKOFYEAR(DATETIME date)

Examples​

MySQL > select weekofyear('2008-02-20 00:00:00');
+-----------------------------------+
| weekofyear('2008-02-20 00:00:00') |
+-----------------------------------+
| 8 |
+-----------------------------------+

keyword​

WEEKOFYEAR

Rocky the happy otterStarRocks Assistant

AI generated answers are based on docs and other sources. Please test answers in non-production environments.