MySQL 8.1
DAYNAME(date)Parameters
- dateDATE
- Date or datetime
Return value
A string with the weekday name, in English by default, for example Thursday; NULL for an incomplete date (2022-00-00) and for an unrecognized value
Examples
Name of the weekday
MySQL 8.1
SELECT DAYNAME('2022-06-16');Weekday of birth
MySQL 8.1
SELECT member_name,
birthday,
DAYNAME(birthday) AS birth_weekday
FROM FamilyMembers;Details
The language of the name is set by the lc_time_names variable: after SET lc_time_names = 'de_DE' the function returns «Donnerstag». For sorting and comparison, the day number is more convenient: DAYOFWEEK or WEEKDAY.