Collections:
WEEKDAY() - Weekday (0=Monday)
How to calculate the weekday index from a given date using the WEEKDAY() function?
✍: FYIcenter.com
WEEKDAY(date) is a MySQL built-in function that
returns the weekday index from a given date.
For example:
SELECT WEEKDAY(NOW()), DAYOFWEEK(NOW()), DAYNAME(NOW()), NOW(); -- +----------------+------------------+----------------+---------------------+ -- | WEEKDAY(NOW()) | DAYOFWEEK(NOW()) | DAYNAME(NOW()) | NOW() | -- +----------------+------------------+----------------+---------------------+ -- | 3 | 5 | Thursday | 2023-11-16 08:05:56 | -- +----------------+------------------+----------------+---------------------+
Reference information of the WEEKDAY() function:
WEEKDAY(date): int Returns the weekday index for date (0 = Monday, 1 = Tuesday, … 6 = Sunday). Arguments, return value and availability: date: Required. The date to extract the weekday index from. int: Return value. The weekday index. Available since MySQL 4.
Related MySQL functions:
⇒ WEEKOFYEAR() - Calendar Week of Year
2023-11-16, 1102🔥, 0💬
Popular Posts:
Where to find answers to frequently asked questions on PHP Connections and Query Execution for MySQL...
How To Recover a Dropped Index in Oracle? If you have the recycle bin feature turned on, dropped ind...
What Is Program Global Area (PGA) in Oracle? A Program Global Area (PGA) is a memory buffer that is ...
How To Concatenate Two Binary Strings Together in SQL Server Transact-SQL? SQL Server 2005 allows to...
How To Assign Debug Privileges to a User in Oracle? In order to run SQL Developer in debug mode, the...