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, 980🔥, 0💬
Popular Posts:
Where Is the Export Dump File Located in Oracle? If you are not specifying the dump directory and fi...
How To Get Year, Month and Day Out of DATETIME Values in SQL Server Transact-SQL? You can use DATEPA...
Why I Can Not Enter 0.001 Second in DATETIME values in SQL Server Transact-SQL? If you enter millise...
What Happens If the Imported Table Already Exists in Oracle? If the import process tries to import a...
How to set the current database in SQL Server? Once you are connected to the SQL Server, you should ...