Name
DAYOFMONTH( )
Synopsis
DAYOFMONTH(date
)
This function returns the day of the month for the date given. It returns NULL if the day for the date is greater than 31. It will accept a date like 2005-02-31 as valid and will return 31. Future releases of MySQL will resolve this problem.
SELECT DAYOFMONTH('2005-03-01') AS 'Day of Month'; +---------------+ | Day of Month | +---------------+ | 1 | +---------------+
This is more meaningful when you apply it to a date column where the date is unknown before entering the SQL statement.
Get MySQL in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.