DAYNAME() in MySQL — How It Works
What the MySQL DAYNAME() function does, with an example.
Published October 20, 2026
DAYNAME(date) returns the weekday name (Monday, Tuesday, ...) for a date, in the language set by lc_time_names.
How it works
Useful for reports by weekday.
Try it in MySQL
SELECT DAYNAME('2026-11-12')
Thursday
SELECT DAYNAME(NOW())
today's weekday
SELECT DAYNAME(d), COUNT(*) FROM orders GROUP BY 1
orders per weekday
Practical examples
Example 1
SELECT DAYNAME('2026-11-12');
-- ThursdayExample 2
SELECT DAYNAME(NOW());
-- today's weekdayExample 3
SELECT DAYNAME(d), COUNT(*) FROM orders GROUP BY 1;
-- orders per weekdayUse it in a real query
SELECT id, DAYNAME('2026-11-12') AS result
FROM your_table
LIMIT 10;Common mistakes
- Ordering weekday names alphabetically (order by WEEKDAY instead).
- Language settings.
- Applying to strings that are not dates.
Key takeaways
- DAYNAME() in one line: DAYNAME(date) returns the weekday name (Monday, Tuesday, ...) for a date, in the language set by lc_time_names.
- Try queries in a test database first.
- Check NULL handling and data types.
FAQ
Order Monday–Sunday?
ORDER BY WEEKDAY(d).
Does DAYNAME() work in other databases?
Most have an equivalent, but names and syntax vary between MySQL, PostgreSQL, SQL Server and SQLite.