MySQL 8.1
DAY(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 DAY('2022-06-16');Day of the month for payments
MySQL 8.1
SELECT payment_id,
date,
DAY(date) AS day_of_month
FROM Payments;Details
The function is a synonym for DAYOFMONTH.