Retrieve the concatenated year and week number for a specified date.
SELECT YEARWEEK(“2017-06-15”); |
The YEARWEEK() function returns the year and week number (ranging from 0 to 53) for a specified date.
YEARWEEK(date, firstdayofweek) |
Parameter |
Description |
date |
Required: The date or datetime value from which to extract the year and week number. |
firstdayofweek |
Optional: Specifies the starting day of the week, which can be any of the following options:
|
Works in: |
From MySQL version 4.0 |
Retrieve the year and week number concatenated for a given date.
SELECT YEARWEEK(“2017-10-25”);SELECT YEARWEEK(“2017-10-25”); |
Retrieve the year and week number concatenated for the current system date.
SELECT YEARWEEK(CURDATE()); |