Retrieve the week number corresponding to a specific date.
SELECT WEEK(“2017-06-15”); |
The WEEK() function returns the week number (ranging from 0 to 53) for a specified date.
WEEK(date, firstdayofweek) |
Parameter |
Description |
date |
Required: The date or datetime from which to extract the 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 week number corresponding to a specific date.
SELECT WEEK(“2017-10-25”); |
Retrieve the week number for the current date according to the system’s settings.
SELECT WEEK(CURDATE()); |