Function Reference

DAYNAME

PostgreSQL equivalent:

Returns the weekday name of a date.

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');
DAYNAME('2022-06-16')
Thursday

Weekday of birth

MySQL 8.1
SELECT member_name,
	birthday,
	DAYNAME(birthday) AS birth_weekday
FROM FamilyMembers;
member_namebirthdaybirth_weekday
Headley Quincey1960-05-13Friday
Flavia Quincey1963-02-16Saturday
Andie Quincey1983-06-05Sunday
Lela Quincey1985-06-07Friday
Annie Quincey1988-04-10Sunday
Ernest Forrest1961-09-11Monday
Constance Forrest1968-09-06Friday
Wednesday Addams2005-01-13Thursday

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.

See also