v.22.4New Feature

Add toLastDayOfMonth function to round date to month's end

Add toLastDayOfMonth function which rounds up a date or date with time to the last day of the month. #33501. #34394 (Habibullah Oladepo).
Introduces the toLastDayOfMonth function that rounds a date or datetime value up to the last day of its month.

Why it matters

This function simplifies operations where users need to normalize dates to the last day of their month, eliminating manual calculations or complex expressions. It enhances date manipulation capabilities and is particularly useful for generating month-end reports or aggregations.

How to use it

Use the function by passing a date or datetime expression as an argument. For example:

SELECT toLastDayOfMonth(<date_or_datetime_column>) FROM <table>;

This will return the date rounded up to the last day of the respective month.