LAST_DAY function returns the last day of the month which the date belongs to. Date is a string in the format ‘yyyy-MM-dd HH:mm:ss’ or ‘yyyy-MM-dd’. The time part of date is ignored.
Syntax: last_day(string date)
Examples:
SELECT last_day(current_date);
Returns 2021-02-28 since it was executed on 6th Feb 2021
SELECT last_day(current_timestamp);
Returns the same and the time-part has been ignored.
2 comments