Collections:
WEEKOFYEAR() - Calendar Week of Year
How to calculate the calendar week of year from a given date using the WEEKOFYEAR() function?
✍: FYIcenter.com
WEEKOFYEAR(date) is a MySQL built-in function that
calculates the calendar week of year from a given date.
For example:
SELECT WEEKOFYEAR('2024-03-04'), WEEK('2024-03-04', 3), WEEK('2024-03-04');
-- +--------------------------+-----------------------+--------------------+
-- | WEEKOFYEAR('2024-03-04') | WEEK('2024-03-04', 3) | WEEK('2024-03-04') |
-- +--------------------------+-----------------------+--------------------+
-- | 10 | 10 | 9 |
-- +--------------------------+-----------------------+--------------------+
Reference information of the WEEKOFYEAR() function:
WEEKOFYEAR(date): int Returns the calendar week of the date as a number in the range from 1 to 53. WEEKOFYEAR() is a compatibility function that is equivalent to WEEK(date,3). Arguments, return value and availability: date: Required. The date to extract the calendar week of year from. int: Return value. The calendar week of year. Available since MySQL 4.
Related MySQL functions:
⇐ WEEKDAY() - Weekday (0=Monday)
2023-11-17, 985🔥, 0💬
Popular Posts:
How to execute statements in loops in SQL Server Transact-SQL? How to use WHILE ... loops? You can u...
How to run Queries with SQL Server Management Studio Express in SQL Server? 1. Launch and connect SQ...
How To View Data Files in the Current Database in Oracle? If you want to get a list of all tablespac...
How To Calculate DATETIME Value Differences Using the DATEDIFF() Function in SQL Server Transact-SQL...
Where to find answers to frequently asked questions on PHP Connections and Query Execution for MySQL...