Function Reference

DAYOFMONTH

PostgreSQL equivalent:

Returns the day of the month of a date.

MySQL 8.1
DAYOFMONTH(date)

Parameters

dateDATE
Date or datetime

Return value

An integer from 1 to 31; 0 for a date with a zero day, for example 2022-00-00; NULL if the value is not recognized as a date

Examples

Day of the month from a date

MySQL 8.1
SELECT DAYOFMONTH('2022-06-16');
DAYOFMONTH('2022-06-16')
16

Day of the month for birthdays

MySQL 8.1
SELECT member_name,
	DAYOFMONTH(birthday) AS birth_day
FROM FamilyMembers;
member_namebirth_day
Headley Quincey13
Flavia Quincey16
Andie Quincey5
Lela Quincey7
Annie Quincey10
Ernest Forrest11
Constance Forrest6
Wednesday Addams13

Details

The function is a synonym for DAY.

See also