ID EN
Date and Time Functions

YEARWEEK(date)

MySQL 8.4

YEARWEEK(date), YEARWEEK(date,mode)

Syntax

MYSQL
SELECT YEARWEEK('1987-01-01');
198652

Examples

Example

Returns year and week for a date. The year in the result may be different from the year in the date argument for the first and the last week of the year. Returns NULL if date is NULL.

MYSQL
SELECT YEARWEEK('1987-01-01');
198652