LAST_DAY()
LAST_DAY(date
)
Returns the last day of the month for the given DATETIME
value
date
. If the argument is invalid, it
returns NULL
. This code:
SELECT LAST_DAY('2016-02-03'); SELECT LAST_DAY('2016-03-11'); SELECT LAST_DAY('2016-04-26');
returns the following values:
2016-02-29 2016-03-31 2016-04-30
As you’d expect, it correctly returns the 28th day of February, the 31st of March, and the 30th of April 2011.