The DAY or DAYOFMONTH function returns day in the range of 1 to 31 from the specified parameter. You can specify the DATE, TIMESTAMP, or DATETIME type; the value is returned in INTEGER type.
0 is not allowed in the argument value corresponding to year, month, and day; however, if 0 is inputted in every argument value corresponding to date, 0 is returned as an exception.
DAY(date)
DAYOFMONTH(date)
SELECT DAYOFMONTH('2010-09-09');
dayofmonth('2010-09-09')
===========================
9
SELECT DAY('2010-09-09 19:49:29');
day('2010-09-09 19:49:29')
=============================
9
SELECT DAYOFMONTH('01:02:03');
ERROR: Conversion error in date format.
SELECT DAYOFMONTH('0000-00-00 00:00:00');
dayofmonth('0000-00-00 00:00:00')
====================================
0