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






Questions and answers:
Clink on Option to Answer




1. Get day of month ...

  • a) SELECT {{DAYOFMONTH}}('2007-02-03');
  • b) SELECT {{DAY}}('2007-02-03');

2. Get last day of the month ...

  • a) SELECT LASTDAY('{{2004-02-05}}');
  • b) SELECT LAST_DAY('{{2003-03-32}}');


References: