WEEKOFYEAR(): Week Number of the year from input date

SELECT WEEKOFYEAR('2024-01-01'); # 1
SELECT WEEKOFYEAR('2024-01-04'); # 1
SELECT WEEKOFYEAR('2024-12-28'); # 52
SELECT WEEKOFYEAR('2024-12-31'); # 1

Syntax
WEEKOFYEAR(date)
Example
SELECT WEEKOFYEAR('2015-08-21')
Output is 34

SELECT CURDATE() dt1, WEEKOFYEAR(CURDATE()) dt2 
Output is 2025-10-15 41

By using CURDATE() we can get present week number of the year.
SELECT WEEKOFYEAR( CURDATE( ) )

For a invalid date we will get Null as output
SELECT WEEKOFYEAR('2015-02-31')
Output is NULL
WEEKDAY() function to get number from 0 to 6 based on Weekday in MySQL

DEMO: Select date from Calendar to execute WEEKOFYEAR()
Monday is the starting day of the week.
This function is same as WEEK() function when mode is equal to 3
SQL Date WEEK() : Week Number in Year( 0 to 53 )
Subhendu Mohapatra — author at plus2net
Subhendu Mohapatra

Author

🎥 Join me live on YouTube

Passionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.



Subscribe to our YouTube Channel here



plus2net.com




SQL Video Tutorials










We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
©2000-2025   plus2net.com   All rights reserved worldwide Privacy Policy Disclaimer