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, 1088🔥, 0💬
Popular Posts:
What Happens If the UPDATE Subquery Returns Multiple Rows in SQL Server? If a subquery is used in a ...
How to download and install Microsoft .NET Framework Version 2.0 in SQL Server? .NET Framework Versi...
How To Escape Special Characters in SQL statements in MySQL? There are a number of special character...
Why I Can Not Enter 0.001 Second in DATETIME values in SQL Server Transact-SQL? If you enter millise...
How To Select All Columns of All Rows from a Table with a SELECT statement in SQL Server? The simple...