The following query will provide the month’s number of days for the specified date. This will come in handy if we need to figure out how many days of the month a given date falls on. If we need to know how many working days are in a month, this will certainly help.
The query uses two functions. One is DAYOFMONTH and LAST_DAY.
LAST_DAY returns the last date for the specified date. DAYOFMONTH returns the date of the current or specified day.
It returns 31, 28, and 30 respectively.
Hope this helps.