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, 1113🔥, 0💬
Popular Posts:
How AdventureWorksLT tables are related in SQL Server? There are 12 user tables defined in Adventure...
How To Verify Your PHP Installation in MySQL? PHP provides two execution interfaces: Command Line In...
How to set database to be READ_ONLY in SQL Server? Databases in SQL Server have two update options: ...
How To Generate CREATE VIEW Script on an Existing View in SQL Server? If you want to know how an exi...
How To Download Oracle Database 10g XE in Oracle? If you want to download a copy of Oracle Database ...