This tutorial explains how to use the MySQL DAYNAME function with syntax and examples.
The MySQL DAYNAME function returns the weekday name for a date.
The syntax for the DAYNAME function in MySQL is:
DAYNAME( date_value )
The date or datetime value from which to extract the weekday name.
The DAYNAME function can be used in the following versions of MySQL:
Let's look at some MySQL DAYNAME function examples and explore how to use the DAYNAME function in MySQL.
For example:
mysql> SELECT DAYNAME('2014-01-27');
Output: 'Monday'
mysql> SELECT DAYNAME('2014-01-28');
Output: 'Tuesday'
mysql> SELECT DAYNAME('2014-01-29 08:35:17');
Output: 'Wednesday'
This last DAYNAME example would display the weekday name for the current system date (current system date is returned by the CURDATE function).
mysql> SELECT DAYNAME(CURDATE());