How can I calculate the last day of the month in Mysql?

February 14, 2019
mysql

Recently I needed to derive the last day of the calendar month for a specific column. It turns out that Mysql has a function just for that - LAST_DAY().

Here is an example of the usage:

SELECT DocumentDate, LAST_DAY(DocumentDate)
FROM mytable;

Here is a link to the official documentation - https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_last-day