Get month day / Day

Returns the day of the month for a date.
 
SELECT DAYOFMONTH('2007-02-03');

        -> 3

Get last month day / Last

Takes a date or datetime value and returns the value for the last day of the month. Returns NULL if the argument is invalid.
 
SELECT LAST_DAY('2003-02-05');

        -> '2003-02-28'

SELECT LAST_DAY('2004-02-05');

        -> '2004-02-29'

SELECT LAST_DAY('2003-03-32');

        -> NULL




References: