Database Theory 1024x768 1

How to Get the Last Day of the Month in MySQL

We can use “LAST_DAY()” method to get the last day of the month in MySQL. It takes date in string format as a parameter which we have shown below.  We have explain the method how we can get the last day of the month in MySQL which anyone can master easily.

SELECT LAST_DAY('2030-04-15');

By this query we can get last day of every month of the year.

SELECT 
    LAST_DAY('2030-01-15') AS "Jan",
    LAST_DAY('2030-02-15') AS "Feb",
    LAST_DAY('2030-03-15') AS "Mar",
    LAST_DAY('2030-04-15') AS "Apr",
    LAST_DAY('2030-05-15') AS "May",
    LAST_DAY('2030-06-15') AS "Jun",
    LAST_DAY('2030-07-15') AS "Jul",
    LAST_DAY('2030-08-15') AS "Aug",
    LAST_DAY('2030-09-15') AS "Sep",
    LAST_DAY('2030-10-15') AS "Oct",
    LAST_DAY('2030-11-15') AS "Nov",
    LAST_DAY('2030-12-15') AS "Dec";

If you have any question, please write in comments section.