[MySQL] Get the last day of a month

Created on November 30, 2026

You can pass a date to LAST_DAY() to get the last date of that month. This example gets the last day of March 2024.

SELECT LAST_DAY('2024-03-01') AS month_end;
2024-03-31
MySQL