Last updated 1 year ago
This function returns the last day of the month containing a specified date, with an optional offset. ().
EOMONTH ( start_date [, month_to_add ] )
LAST_DAY( <date_or_time_expr> [ , <date_part> ] )
Code:
SELECT EOMONTH (GETDATE()) AS Result;
Result:
RESULT| ----------+ 2022-05-31|
SELECT LAST_DAY(DATEADD('month', 0, CURRENT_TIMESTAMP() :: TIMESTAMP)) AS Result;